Move NamedTuple from typing module to collections

The NamedTuple (typing — Support for type hints — Python 3.13.0 documentation) object does not feel correctly placed in the typing module.

Yes, I agree that it is a typed version of collections.namedtuple, but I can’t do anything with my feelings that it is the wrong import. At first, it was also confusing to me that this object is runtime-available and useful as a data container.

Should it be placed into the collections near the regular named tuple similarly?

It is similar to PEP 585, which is related to collection interfaces to be moved from typing to collections.abc

11 Likes