Message341160
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). |
|
Date |
User |
Action |
Args |
2019-04-30 18:48:02 | wim.glenn | set | recipients:
+ wim.glenn |
2019-04-30 18:48:02 | wim.glenn | set | messageid: <1556650082.38.0.163364239874.issue36761@roundup.psfhosted.org> |
2019-04-30 18:48:02 | wim.glenn | link | issue36761 messages |
2019-04-30 18:48:02 | wim.glenn | create | |
|