[New-bugs-announce] [issue38855] test_unpack.py does not catch the unpacking of a set

Cat Chenal report at bugs.python.org
Tue Nov 19 16:44:26 EST 2019


New submission from Cat Chenal <catchenal at gmail.com>:

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).

----------
components: Tests, ctypes
messages: 356994
nosy: Ylem
priority: normal
severity: normal
status: open
title: test_unpack.py does not catch the unpacking of a set
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38855>
_______________________________________


More information about the New-bugs-announce mailing list