On Sun, Jul 14, 2013 at 7:12 PM, Nick Coghlan <ncoghlan@gmail.com> wrote:
One interesting point I see is that the "*expr" syntax in comprehensions is getting close to a nested "yield from": [...] # Flattening generator expression g = (*x for x in iterable)
def _g(outermost_iterable): for x in outermost_iterable: yield from x
g = _g(iterable)
The meaning for list and set comprehensions then follows from the generator expression semantics.
Interesting. I don't know if Joshua intended this translation, but given that it's special syntax anyway it does sound interesting. I'd like to see an implementation though -- to verify that it's not too hard to implement correct, and that the syntax is actually unambiguous. -- --Guido van Rossum (python.org/~guido)