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.

Author Ben Burrill
Recipients Ben Burrill
Date 2018-01-22.22:39:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1516660799.03.0.467229070634.issue32626@psf.upfronthosting.co.za>
In-reply-to
Content
PEP 448 defines unpacking generalizations for tuples.  However, this does not currently work for subscripted tuples that are not delimited by parentheses.

Current behavior (Tested on 3.6/3.7a4):
>>> class Subscriptable:
...     def __getitem__(self, item):
...         return item
...
>>> ss = Subscriptable()
>>> 
>>> 1, 2, 3
(1, 2, 3)
>>> ss[1, 2, 3]
(1, 2, 3)
>>> *range(5), 42
(0, 1, 2, 3, 4, 42)
>>> ss[*range(5), 42]  # This should be the same as above
  File "<stdin>", line 1
    ss[*range(5), 42]
       ^
SyntaxError: invalid syntax
>>> ss[(*range(5), 42)]  # Workaround
(0, 1, 2, 3, 4, 42)
History
Date User Action Args
2018-01-22 22:39:59Ben Burrillsetrecipients: + Ben Burrill
2018-01-22 22:39:59Ben Burrillsetmessageid: <1516660799.03.0.467229070634.issue32626@psf.upfronthosting.co.za>
2018-01-22 22:39:59Ben Burrilllinkissue32626 messages
2018-01-22 22:39:58Ben Burrillcreate