Skip to content
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

Allow keyword arguments when creating namedtuple #16579

Open
nemesmihaly opened this issue Nov 28, 2023 · 0 comments
Open

Allow keyword arguments when creating namedtuple #16579

nemesmihaly opened this issue Nov 28, 2023 · 0 comments
Labels
bug mypy got something wrong topic-named-tuple

Comments

@nemesmihaly
Copy link

Bug Report
The program:

from collections import namedtuple

Point = namedtuple(typename='Point', field_names=['x', 'y'])
p_1 = Point(2, 7)

The first line is marked by mypy:

Unexpected arguments to "namedtuple()" [misc]

I think it should be allowed to use argument names in the call.

The second line is marked so:

Too many arguments for "Point" [call-arg]

I think this is definitely a false positive.

(A clear and concise description of what the bug is.)

To Reproduce

# Ideally, a small sample program that demonstrates the problem.
# Or even better, a reproducible playground link https://mypy-play.net/ (use the "Gist" button)

Expected Behavior

Actual Behavior

Your Environment

  • Mypy version used: 1.7.1
  • Mypy command-line flags: None
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.11.4
@nemesmihaly nemesmihaly added the bug mypy got something wrong label Nov 28, 2023
@JelleZijlstra JelleZijlstra changed the title namedtuple function signature Allow keyword arguments when creating namedtuple Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-named-tuple
Projects
None yet
Development

No branches or pull requests

2 participants