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

2020-10-20 Thread Guido van Rossum


Change by Guido van Rossum :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-10-20 Thread miss-islington


miss-islington  added the comment:


New changeset d05514ace652769457e6228f0186d4f830b676b9 by Miss Skeleton (bot) 
in branch '3.9':
[3.9] bpo-42010: [docs] Clarify subscription of types (GH-22822) (GH-22840)
https://github.com/python/cpython/commit/d05514ace652769457e6228f0186d4f830b676b9


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-10-20 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +21794
pull_request: https://github.com/python/cpython/pull/22840

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-10-20 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 7cdf30fff39ea97f403b5472096349998d190e30 by kj in branch 'master':
bpo-42010: [docs] Clarify subscription of types (GH-22822)
https://github.com/python/cpython/commit/7cdf30fff39ea97f403b5472096349998d190e30


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-10-20 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I think kj's patch is ready to merge.  Guido, do you want to take a look?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-10-20 Thread Ken Jin


Change by Ken Jin :


--
pull_requests: +21779
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/22822

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-10-16 Thread Guido van Rossum


Guido van Rossum  added the comment:

That sentence has been a lie for a long time (from the start?).

Any type can define __getitem__ and get this behavior, though in this case it 
is done through __class_getitem__ (PEP NNN).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-10-16 Thread Terry J. Reedy


Terry J. Reedy  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@python
components: +Documentation -Interpreter Core
nosy: +docs@python, terry.reedy
stage: patch review -> needs patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-10-12 Thread Ken Jin


Ken Jin  added the comment:

Partly due to Python 3.9.0's nascency, I've not been able to find online cases 
of beginners getting confused by this specific behavior.

Wow I didn't know about integer variadics, assuming they make their way into 
3.11, I can see why it'd be better to leave that in for now.

I'm going to close the PR, and if there are no more discussions in the next 30 
days, I'll close this bug report too. Thanks for clarifying.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-10-12 Thread Guido van Rossum


Guido van Rossum  added the comment:

Have you observed actual users getting confused by this? (E.g. StackOverflow or 
mailing list posts.) I would assume that if you try to *do* anything with the 
resulting object it's going to cause a traceback, and from there it's pretty 
straightforward to debug the situation. (Maybe not for absolute beginners, but 
they have a lot of ways to confuse themselves. :-)

There are people working on proposals for "integer variadics" that would 
actually give meaning to things like list[10] (or at least to A[10] and A[N, M] 
where A is a tensor type) so I am reluctant to forbid this now -- we might have 
to allow it in the next release.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-10-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +gvanrossum, levkivskyi

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-10-12 Thread Ken Jin


Ken Jin  added the comment:

I'd like to clarify the following too, currently:

(1)
>>> list[1]
list[1]

(2)
>>> list[1, 2, 3]
list[1, 2, 3]

The PR only solves (1) and not (2), is (2) intended behavior?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-10-12 Thread Ken Jin


Change by Ken Jin :


--
title: Generic types accepts indexing/subscripting, causing confusion -> 
Generic types accept indexing/subscripting, causing confusion

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com