[issue42010] Generic types accept indexing/subscripting, causing confusion

Terry J. Reedy report at bugs.python.org
Fri Oct 16 17:12:25 EDT 2020


Terry J. Reedy <tjreedy at udel.edu> added the comment:

Subscription of list and dict (only with '') and ??? is at least puzzling.  Removal of a new feature after release is a bad idea.  But this new feature, expansion of subscription, needs to documented in
https://docs.python.org/3/reference/expressions.html#subscriptions
as legal code.

The current first line

 "A subscription selects an item of a sequence (string, tuple or list) or mapping (dictionary) object:"

is no longer always true.  This suggested replacement is:

 "Subscription of a sequence (string, tuple or list) or mapping (dictionary) object selects an item from the collection."

Then at the end, add something like

 "Subscription of certain type objects creates a Generic Alias.

where 'Generic Alias links to where such are documented.

----------
assignee:  -> docs at python
components: +Documentation -Interpreter Core
nosy: +docs at python, terry.reedy
stage: patch review -> needs patch

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42010>
_______________________________________


More information about the Python-bugs-list mailing list