[issue38855] test_unpack.py does not catch the unpacking of a set

2019-11-22 Thread Zachary Ware


Zachary Ware  added the comment:

Absent clarification from the OP (though it appears some may have been added to 
bpo-38853), I'm closing the issue.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38855] test_unpack.py does not catch the unpacking of a set

2019-11-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I'm also unclear on what you're looking for.  Unpacking is documented to allow 
any iterable.  This includes all kinds of potentially weird but potentially 
useful cases including unordered collections, strings, files, etc.  These 
behaviors are unlikely to change.

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38855] test_unpack.py does not catch the unpacking of a set

2019-11-19 Thread Zachary Ware


Zachary Ware  added the comment:

It's not clear what you're asking for here.  Your example works, though the 
contents of `a` and `c` will each be an arbitrary member of S and `b` the rest 
of the members of S and you have no guarantee of what you'll get.  If you want 
to be sure of what each name will be attached to, just do `a, *b, c = 
sorted(S)`.

--
nosy: +zach.ware

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38855] test_unpack.py does not catch the unpacking of a set

2019-11-19 Thread Cat Chenal


New submission from Cat Chenal :

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com