-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Description
Currently an instance variable can be accessed using the class, which is wrong. For example, this code is accepted by the type checker:
class A:
def f(self) -> None:
self.x = 1
A.x = 1 # accepted, but should be an error
Class variables need to be assigned in the class body:
class A:
x = 1
A.x = 1 # ok, and should be ok
revolter, lemon24, FeldrinH, vmarkovtsev, antoninkriz and 4 morevtgn