Skip to content

Unexpected result with NamedTuple(name, zip(keys, values)) #144321

@randolf-scholz

Description

@randolf-scholz

Bug report

Bug description:

from typing import NamedTuple

field_names = ["x", "y"]
field_values = [int, int]
Point = NamedTuple("Point", zip(field_names, field_values))
Point(1, 2)  # TypeError: point.__new__() takes 1 positional argument but 3 were given

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

Labels

stdlibStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions