Skip to content
Discussion options

You must be logged in to vote

Please refer to this documentation for an explanation of how pyright treats class and instance variables. In your example, the class-scoped variable id is treated as a "regular class variable" that may be accessed from the class but may also be overwritten by an instance. It is neither a "pure class variable" or a "pure instance variable".

The typing spec does not currently provide much guidance for type checkers in this regard. It's an area where additional formalization and specification is needed.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@qexat
Comment options

@erictraut
Comment options

Answer selected by qexat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants