On 01:00 am, greg.ew...@canterbury.ac.nz wrote:
Guido van Rossum wrote:
We already have yield expressions and they mean something else...

They don't have a "*" in them, though, and I don't
think the existing meaning of yield as an expression
would carry over into the "yield *" variant, so there
shouldn't be any conflict.

But if you think there will be a conflict, or that the
similarity would be too confusing, maybe the new
construct should be called something else. I'm
open to suggestions.

I'm *already* regretting poking my head into this particular bike shed, but...

has anyone considered the syntax 'yield from iterable'?  i.e.

   def foo():
       yield 1
       yield 2

   def bar():
       yield from foo()
       yield from foo()

list(bar()) -> [1, 2, 1, 2]

I suggest this because (1) it's already what I say when I see the 'for' construct, i.e. "foo then *yield*s all results *from* bar", and (2) no new keywords are required.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to