Skip to content

NamedTuple subclassing NamedTuple #427

Closed
@gvanrossum

Description

@gvanrossum

I naively thought that since I can write

class A(NamedTuple):
    x: int
    y: int

I would also be able to subclass this:

class B(A):
    z: int

That is accepted syntactically and at runtime but no new __new__ method is generated so calling B(1, 2, 3) is flagged as an error (too many arguments) by both mypy and runtime.

Metadata

Metadata

Assignees

Labels

resolution: wontfixA valid issue that most likely won't be resolved for reasons described in the issue

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions