-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
NamedTuple doesn't accept field called count
#3950
Comments
This is not a bug, |
Just hit this and couldn't work out what the underlying issue was. I looked in the docs for both There are a some other things which conspire to make this harder to understand: from typing import NamedTuple
Foo = NamedTuple('Foo', (
('count', int),
)) Secondly, in either spelling the type according to Finally the code does work and seems to behave as expected. I appreciate that this may not be something which mypy can allow, however if that is the case please could it:
Regarding the clarity of this: while I can now (that I understand the issue) see what mypy was saying, I didn't initially understand that the assignment issue was to do with the assignment of the member Would an error message like the following be possible here (emphasis to show changes):
Maybe even add something like:
If there's scope to change the error code from For comparison, the method override error message is (to me) much clearer:
|
The text was updated successfully, but these errors were encountered: