We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
Typechecking with mypy produces a spurious error when accessing default_factory of a dataclass field.
default_factory
# t.py import dataclasses @dataclasses.dataclass class Foo: bar: int field = dataclasses.fields(Foo)[0] assert field.default_factory == dataclasses.MISSING
mypy t.py
Output:
t.py:10: error: Attribute function "default_factory" with type "Callable[[], Any]" does not accept self argument
Using mypy==0.720 on Python 3.7.4.
mypy==0.720
The text was updated successfully, but these errors were encountered:
This looks like a mypy problem to me. The following does not type check either:
from typing import Callable class Foo: bar: Callable[[], None] assert Foo().bar == 1
Sorry, something went wrong.
Ah, found it: python/mypy#6910 . Sorry for the noise.
No branches or pull requests
Uh oh!
There was an error while loading. Please reload this page.
Typechecking with mypy produces a spurious error when accessing
default_factory
of a dataclass field.Output:
Using
mypy==0.720
on Python 3.7.4.The text was updated successfully, but these errors were encountered: