-
Notifications
You must be signed in to change notification settings - Fork 768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can‘t recognize class variable #2365
Comments
This pattern is unusual. You're assigning instances of class For a static analyzer to honor a class variable, you need to declare it within the class definition. Normally you could simply include the assignment ( class A:
A1: "A"
A2: "A"
def __init__(self, a: int = 0) -> None:
self.a = a
def __str__(self) -> str:
return f"A({self.a})"
A.A1 = A(1)
A.A2 = A(2) |
Any way, will pylance support this pattern in the future? |
If you mean "will Pylance ever recognize this as a class variable when you haven't declared the class variable within the class?", the answer is no. |
Closing inactive issue, please reopen if needed |
Environment data
Expected behaviour
example code:
A1,A2
shoudle able to jump to declare positionActual behaviour
aa.A1
asany
.Additional information
sample code:
related issue
#1064
The text was updated successfully, but these errors were encountered: