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
I have a class that defines some constants and uses those constants as defaults for some method arguments. This is fine in Python, but mypy complains that the constant isn't defined. Example:
bash-3.2$ cat /tmp/x.py
import typing
class C:
DEFAULT_LEVEL = 1
def set_level(self, level: int = DEFAULT_LEVEL) -> int:
return level
bash-3.2$ PYTHONPATH=lib-typing/3.2/ python3 /tmp/x.py
bash-3.2$ PYTHONPATH=. python3 scripts/mypy /tmp/x.py
/tmp/x.py: In function "set_level":
/tmp/x.py, line 5: Name 'DEFAULT_LEVEL' is not defined
bash-3.2$
The text was updated successfully, but these errors were encountered:
I have a class that defines some constants and uses those constants as defaults for some method arguments. This is fine in Python, but mypy complains that the constant isn't defined. Example:
The text was updated successfully, but these errors were encountered: