Wouldn't
yield *(x for x in gen1(arg))
be sufficient, and would already be supported by the proposal at hand?
It would, but, as Steven pointed out, the * in func(*args) results in tuple(args) being passed to the underlying function.
So I see no reason to expect "yield *iterable" to imply a for loop that yields the iterators contents. IMO, it's even more of a stretch than the tuple unpacking concept (at least that idea involves tuples!)
Whereas:
yield x for x in iterable if condition
Maps to:
for x in iterable:
if condition:
yield xJust as: [x for x in iterable if condition]
Maps to:
lc = []
for x in iterable:
if condition:
lc.append(x)And: (x for x in iterable if condition)
Maps to:
def g()
for x in iterable:
if condition:
yield xAnd removing a couple of parentheses is at least as clear as adding an asterisk to the front :)
Cheers, Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list
