Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

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

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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