Skip to content

Use typing.NamedTuple instead of collections.namedtuple#822

Closed
DimitriPapadopoulos wants to merge 2 commits intopypa:mainfrom
DimitriPapadopoulos:PYI024
Closed

Use typing.NamedTuple instead of collections.namedtuple#822
DimitriPapadopoulos wants to merge 2 commits intopypa:mainfrom
DimitriPapadopoulos:PYI024

Conversation

@DimitriPapadopoulos
Copy link
Copy Markdown
Contributor

Inheriting from typing.NamedTuple creates a custom tuple subclass in the same way as using the collections.namedtuple factory function. However, using typing.NamedTuple allows you to provide a type annotation for each field in the class.

Inheriting from `typing.NamedTuple` creates a custom `tuple` subclass
in the same way as using the `collections.namedtuple` factory function.
However, using `typing.NamedTuple` allows you to provide a type annotation
for each field in the class.
@brettcannon
Copy link
Copy Markdown
Member

What's the point of the change if there's no change in typing?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants