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: The list of standard generic collections is incomplete
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.10, Python 3.9
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: docs@python Nosy List: AlexWaygood, docs@python, gvanrossum, jack1142, kj, levkivskyi
Priority: normal Keywords:

Created on 2020-11-06 18:49 by jack1142, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 29308 closed AlexWaygood, 2021-10-29 14:11
Messages (6)
msg380467 - (view) Author: Jakub Kuczys (jack1142) * Date: 2020-11-06 18:49
It looks like the documentation lists standard library collections that support parameterized generics[1] however, it seems to only feature a part of all the collections that support parametrizing (I'm going by the list that was produced by Ethan Smith[2], it could be slightly inaccurate now, but that can be cross-checked when making the contribution).

I would be interested in making a PR adding these if/when this issue gets accepted.


[1] https://docs.python.org/3.10/library/stdtypes.html#standard-generic-collections
[2] https://github.com/gvanrossum/cpython/pull/1#issuecomment-582781121
msg380507 - (view) Author: Ken Jin (kj) * (Python committer) Date: 2020-11-07 14:06
Dear Jack, good catch! My only worry is that if we make the list exhaustive,  it would be too lengthy, or that it might not be feasible to continuously update it every time a new generic type supports the feature.

Maybe a line somewhere to mention that most container types in Python should support the feature, and that the list provided is non-exhaustive should suffice?

I'm not sure, nosy-ing Guido and Ivan to the list for their thoughts on this.
msg381052 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2020-11-16 01:50
I think the difference between the two lists is that not every generic type is a collection.

If we apply that standard, I think the contextlib and re classes need to be *removed* from the list (did I get that right?).
msg381055 - (view) Author: Jakub Kuczys (jack1142) * Date: 2020-11-16 02:05
I was thinking that this could be the case but if I'm not mistaken, there's actually quite a lot of types in this list that aren't collections (awaitable, coroutine, iterable, iterator, generator, the async versions of those, callable, *hmm, are views collections?*, and the ones you mentioned), so I figured that listing *only* collections might have not been the intention when this was written. But listing all of the generics in Python would indeed be lengthy so it might make sense to limit it to collections nonetheless, I'm not really sure about it though.
msg381056 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2020-11-16 02:16
Let’s just close this, there are more important things to do.
msg404480 - (view) Author: Ken Jin (kj) * (Python committer) Date: 2021-10-20 15:57
I concur with Guido to close this.
History
Date User Action Args
2022-04-11 14:59:37adminsetgithub: 86446
2021-10-29 14:11:57AlexWaygoodsetnosy: + AlexWaygood

pull_requests: + pull_request27583
2021-10-20 15:57:30kjsetstatus: open -> closed
resolution: wont fix
messages: + msg404480

stage: resolved
2020-11-16 02:16:46gvanrossumsetmessages: + msg381056
2020-11-16 02:05:19jack1142setmessages: + msg381055
2020-11-16 01:50:44gvanrossumsetmessages: + msg381052
2020-11-07 14:06:05kjsetnosy: + gvanrossum, kj, levkivskyi
messages: + msg380507
2020-11-06 18:49:58jack1142create