-
- Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
bugmypy got something wrongmypy got something wrongsemantic-analyzerProblems that happen during semantic analysisProblems that happen during semantic analysistopic-named-tuple
Description
Bug Report
typing.NamedTuple one line declaration gives incorrect error
To Reproduce
# test.py from typing import NamedTuple ExampleClass = NamedTuple('ExampleClass', test_id=str, timestamp=str)mypy --show-error-codes test.py test.py:[line-no]: error: Too many arguments for NamedTuple() [misc]Expected Behavior
mypy doesn't give this error
given the above syntax is valid python and works fine, I would expect it to not throw an error, like the following old structure declaration does not, which is labeled as "back-ward compatible usage" in the official doc
ExampleClass = NamedTuple('ExampleClass', [(test_id, str), (timestamp, str)])Actual Behavior
error: Too many arguments for NamedTuple() [misc]Your Environment
mypy --version mypy 0.910 python --version 3.8.10 BVollmerhaus
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongsemantic-analyzerProblems that happen during semantic analysisProblems that happen during semantic analysistopic-named-tuple