You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The list of standard generic collections is incomplete #86446
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2021-10-20.15:57:30.982>created_at=<Date2020-11-06.18:49:58.028>labels= ['type-feature', '3.9', '3.10', 'docs']
title='The list of standard generic collections is incomplete'updated_at=<Date2021-10-29.14:11:57.475>user='https://github.com/jack1142'
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.
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.
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?).
jack1142 commented on Nov 16, 2020
jack1142mannequin
MannequinAuthor
More actions
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.
Activity
jack1142 commentedon Nov 6, 2020
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] gvanrossum#1 (comment)
Fidget-Spinner commentedon Nov 7, 2020
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.
gvanrossum commentedon Nov 16, 2020
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?).
jack1142 commentedon Nov 16, 2020
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.
gvanrossum commentedon Nov 16, 2020
Let’s just close this, there are more important things to do.
Fidget-Spinner commentedon Oct 20, 2021
I concur with Guido to close this.