yield_all needed in Python

Steven Bethard steven.bethard at gmail.com
Tue Mar 1 20:23:44 EST 2005


Douglas Alan wrote:
> In this case, that is great, since I'd much prefer
> 
>    yield *gen1(arg)
> 
> than
> 
>    yield_all gen1(arg)

I'm guessing the * syntax is pretty unlikely to win Guido's approval. 
There have been a number of requests[1][2][3] for syntax like:

     x, y, *rest = iterable

for unpacking a variable sized list (where *rest would work in an 
analogous way to what it does in the args of a def.)  Guido has 
consistently rejected these proposals, e.g.:

"I think it's not worth adding now, and if you don't hear from me again 
on this topic it's because I haven't changed my mind..."

My suspicion is that if he doesn't like the * syntax when there's a 
close parallel to the argument parsing usage, he's not likely to like it 
when there isn't one.

STeVe

[1]http://mail.python.org/pipermail/python-dev/2002-November/030349.html
[2]http://mail.python.org/pipermail/python-dev/2004-August/046684.html
[3]http://mail.python.org/pipermail/python-dev/2004-November/049895.html



More information about the Python-list mailing list