New submission from Mario Wenzel:

if I have an assignment
a = <some_generator> then a is the generator. 

But if I do any kind of unpacking
*a, = <some_generator> # a list of all items
a, *aa = <some_generator> # first item in a, list of rest in as

If the right-hand side is a generator expression, I would expect that 
a, *aa unpacks the first element into a and puts the whole generator (having 
yielded the first element) back into aa.

So the star-operator of tuple unpacking with the right-hand-side having a 
generator should be lazy and not exhaust the whole generator.

----------
components: Interpreter Core
messages: 253985
nosy: Mario Wenzel
priority: normal
severity: normal
status: open
title: tuple unpacking on assignment should be lazy for unpacked generators
type: enhancement
versions: Python 3.6

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

Reply via email to