[issue45586] Use starred expressions in subscripts

2021-10-26 Thread Dennis Sweeney
Dennis Sweeney added the comment: Yes, I don't believe the PEP is suggesting any changes to list.__getitem__. If you want to suggest such enhancements, I would suggest first sending a message to the python-ideas mailing list or on discuss.python.org. -- _

[issue45586] Use starred expressions in subscripts

2021-10-26 Thread Jacob Nilsson
Jacob Nilsson added the comment: Ok, I see. >>> a[1, 2, *[3, 4]] Would still faith with PEP 646 because lists don't accept tuples, right? >>> a[(1, 2, *[3, 4])] Traceback (most recent call last): File "", line 1, in TypeError: list indices must be integers or slices, not tuple --

[issue45586] Use starred expressions in subscripts

2021-10-25 Thread Peter Tillema
Peter Tillema added the comment: Right, I should have clarified it a bit more. I'm using NumPy arrays because they allow indexing like this, where the input arguments are converted to a tuple. So a[1, 2, *[3, 4]] is different than a[[1, 2, *[3, 4]]] This indeed only works on NumPy arra

[issue45586] Use starred expressions in subscripts

2021-10-23 Thread Dennis Sweeney
Dennis Sweeney added the comment: Jacob wrote: a[[0, *[0, 0], 0]] which passes the *list* [0, 0, 0, 0] into __getitem__. In numpy, passing lists into __getitem__ does things like array([1, 10, 100])[[2, 1]] --> array([100, 10]). But I think Peter is requesting that the following work: