Message 341160 - Python tracker

Message341160

Author wim.glenn
Recipients wim.glenn
Date 2019-04-30.18:48:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1556650082.38.0.163364239874.issue36761@roundup.psfhosted.org>
In-reply-to
Content
Could cases like these be made to work? *Should* cases like these be made to work?

L = [0, 1, 2]
L[::2], *rest = "abcdef"
# ValueError: attempt to assign sequence of size 1 to extended slice of size 2

a, L[::2] = "abc"
# ValueError: too many values to unpack (expected 2)

The list slice knows exactly how many slots need to be filled, so I can't immediately think of any obvious ambiguity. Maybe there are some implementation complications with supporting e.g. generators on the RHS (because RHS must be evaluated before LHS - https://docs.python.org/3/reference/expressions.html#evaluation-order).
History
Date User Action Args
2019-04-30 18:48:02wim.glennsetrecipients: + wim.glenn
2019-04-30 18:48:02wim.glennsetmessageid: <1556650082.38.0.163364239874.issue36761@roundup.psfhosted.org>
2019-04-30 18:48:02wim.glennlinkissue36761 messages
2019-04-30 18:48:02wim.glenncreate