Message356994
S = {19,8,-1,25,0,1,2,3,4,5,6,7}
a, *b, c = S
print('a:', a)
print('b:', b)
print('c:', c)
Output:
a: 0
b: [1, 2, 3, 4, 5, 6, 7, 8, 19, 25]
c: -1
Either test_unpack.py needs a test for "non-indexable object" to prevent this unpacking of a non-sequence, or the unpacking of a set should be implemented (granted the ordered repr of a set is changed to unordered, see Issue38853).
Being able to "unpack" a set would be nice to have, imho, because one would use that operation to obtain a partition (over unordered elements). |
|
Date |
User |
Action |
Args |
2019-11-19 21:44:26 | Ylem | set | recipients:
+ Ylem |
2019-11-19 21:44:26 | Ylem | set | messageid: <1574199866.94.0.505972513072.issue38855@roundup.psfhosted.org> |
2019-11-19 21:44:26 | Ylem | link | issue38855 messages |
2019-11-19 21:44:26 | Ylem | create | |
|