You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mypy doesn't complain about wrong attribute access in unannotated method #1514
mypy complains about method2 and method3, but not method1:
x.py: note: In member "method2" of class "Klass":
x.py:7: error: "Klass" has no attribute "attr"
x.py: note: In member "method3" of class "Klass":
x.py:10: error: "Klass" has no attribute "attr"
Now looking at #1415 I thought adding --check-untyped-defs would help ("type check the interior of functions without type annotations"), but the output doesn't change with that argument. Am I missing something?
Yes, that's a good idea. After all that's the type given to self when there are annotations. Maybe you can even figure out how to do it and submit a
PR?
Activity
gvanrossum commentedon May 10, 2016
The default behavior is as intended, but it looks like the flag may be
causing the type of self to be Any, which would explain it makes no
difference.
gvanrossum commentedon May 25, 2016
Yes, that's a good idea. After all that's the type given to self when there
are annotations. Maybe you can even figure out how to do it and submit a
PR?
Implicitly assign class type to the first parameter of its methods (#…
Implicitly assign class type to the first parameter of its methods (#…
Revert "Implicitly assign class type to the first parameter of its me…
Give self argument the correct type when using check_untyped_defs (#7530