Martin Panter added the comment:

I would prefer this be fixed in the opposite direction, to allow “unpacking” an 
empty iterable using round brackets. I have used this syntax on purpose as a 
concise way to ensure that a generator is exhaused with no more yields:

>>> def gen():
...     yield "partial computation"
...     print("computation allowed to complete")
... 
>>> g = gen()
>>> next(g)
'partial computation'
>>> [] = g
computation allowed to complete

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23275>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to