This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Alias typing.NamedTuple to collections
Type: Stage: resolved
Components: Documentation Versions: Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, gvanrossum, levkivskyi, rhettinger, steven.daprano
Priority: normal Keywords:

Created on 2019-08-10 08:35 by steven.daprano, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (4)
msg349339 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2019-08-10 08:34
As discussed in the thread starting here with Guido's message:

https://mail.python.org/archives/list/python-ideas@python.org/message/WTBXYJJ7CSGDLLJHHPHSH5ZCCA4C7QEP/

and these two follow-ups:

https://mail.python.org/archives/list/python-ideas@python.org/message/SXF3RKYQ6DXFKX2RFMUDUKAWQEGXGHP3/

https://mail.python.org/archives/list/python-ideas@python.org/message/VRCH56CHE4P7IAWO7QRA6TDBISLONGQT/


we should do a better job of advertising typing.NamedTuple by aliasing it in the collections module.

(I'm not sure if this can still go into 3.8, since it's not really a new feature, or if its too late.)
msg349343 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-08-10 16:37
> we should do a better job of advertising typing.NamedTuple

FWIW, I had updated the docs for namedtuple() to link to typing.NamedTuple.  I think that should suffice.
msg349344 - (view) Author: Ivan Levkivskyi (levkivskyi) * (Python committer) Date: 2019-08-10 16:41
> FWIW, I had updated the docs for namedtuple() to link to typing.NamedTuple.  I think that should suffice.

Thank you!  I looked at the docs everything looks good.  I think this can be closed now.
msg349345 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-08-10 16:50
Further notes for posterity:

* Anything written using collections.NamedTuple would instantly lose its backwards compatibility.  

* The casing of NamedTuple is more in line with the typing module:  List, Deque, NamedTuple and doesn't fit well with the deque, namedtuple, and ChainMap in the collections module. 

* Nothing in the collections module currently requires typing, but NamedTuple can only be used with typing.  

* We really don't want to increase import times for collections. This proposal would defeat the entire purpose of having moved _collections_abc to a separate module outside of the collections package.
History
Date User Action Args
2022-04-11 14:59:18adminsetgithub: 81990
2019-08-10 16:50:42rhettingersetmessages: + msg349345
2019-08-10 16:41:45levkivskyisetstatus: open -> closed

assignee: docs@python
components: + Documentation

nosy: + docs@python
messages: + msg349344
resolution: fixed
stage: resolved
2019-08-10 16:37:43rhettingersetnosy: + rhettinger
messages: + msg349343
2019-08-10 08:35:00steven.dapranocreate