Re: [Python-Dev] yield back-and-forth?

2006-01-25 Thread Morel Xavier
Christian Tanzer wrote: How about: def main_generator(): ... yield * sub_generator() Ducking-ly yrs, I like that one, but I'd stick the star to the generator (e.g. yield *sub_generator), the meaning being to unpack the generator into the yield, same as unpacking a

[Python-Dev] yield back-and-forth?

2006-01-20 Thread Guido van Rossum
The discussion about PEP 343 reminds me of the following. Bram Cohen pointed out in private email that, before PEP 342, there wasn't a big need for a shortcut to pass control to a sub-generator because the following for-loop works well enough: def main_generator(): ... for value in

Re: [Python-Dev] yield back-and-forth?

2006-01-20 Thread Christian Tanzer
Guido van Rossum [EMAIL PROTECTED] wrote: The discussion about PEP 343 reminds me of the following. Bram Cohen pointed out in private email that, before PEP 342, there wasn't a big need for a shortcut to pass control to a sub-generator because the following for-loop works well enough: def

Re: [Python-Dev] yield back-and-forth?

2006-01-20 Thread Phillip J. Eby
At 10:17 AM 01/20/2006 -0800, Guido van Rossum wrote: The discussion about PEP 343 reminds me of the following. Bram Cohen pointed out in private email that, before PEP 342, there wasn't a big need for a shortcut to pass control to a sub-generator because the following for-loop works well enough:

Re: [Python-Dev] yield back-and-forth?

2006-01-20 Thread Guido van Rossum
On 1/20/06, Phillip J. Eby [EMAIL PROTECTED] wrote: At 10:17 AM 01/20/2006 -0800, Guido van Rossum wrote: The discussion about PEP 343 reminds me of the following. Bram Cohen pointed out in private email that, before PEP 342, there wasn't a big need for a shortcut to pass control to a

Re: [Python-Dev] yield back-and-forth?

2006-01-20 Thread Edward C. Jones
Guido van Rossum [EMAIL PROTECTED] wrote: The discussion about PEP 343 reminds me of the following. Bram Cohen pointed out in private email that, before PEP 342, there wasn't a big need for a shortcut to pass control to a sub-generator because the following for-loop works well enough: def

Re: [Python-Dev] yield back-and-forth?

2006-01-20 Thread Phillip J. Eby
At 11:19 AM 01/20/2006 -0800, Guido van Rossum wrote: (There *are*other uses besides the trampoline, right? :-) It's easy to come up with use cases where you feed data *into* a generator (parsers and pipelines, for example). I just don't know of any simultaneous bidirectional uses other than

Re: [Python-Dev] yield back-and-forth?

2006-01-20 Thread Nick Coghlan
Phillip J. Eby wrote: Thoughts? If we have to have a syntax, yield from sub_generator() seems clearer than yieldthrough, and doesn't require a new keyword. Andrew Koenig suggested the same phrasing last year [1], and I liked it then. I don't like it any more, though, as I think it is too

Re: [Python-Dev] yield back-and-forth?

2006-01-20 Thread Nick Coghlan
Nick Coghlan wrote: Exception propagation is a different story. What do you want to propagate? All exceptions from the body of the for loop? Or just those from the yield statement? Well, isn't factoring out exception processing part of what PEP 343 is for? # We can even limit the

Re: [Python-Dev] yield back-and-forth?

2006-01-20 Thread Andrew Koenig
The discussion about PEP 343 reminds me of the following. Bram Cohen pointed out in private email that, before PEP 342, there wasn't a big need for a shortcut to pass control to a sub-generator because the following for-loop works well enough: def main_generator(): ... for

Re: [Python-Dev] yield back-and-forth?

2006-01-20 Thread Alex Martelli
On Jan 20, 2006, at 1:39 PM, Phillip J. Eby wrote: At 11:19 AM 01/20/2006 -0800, Guido van Rossum wrote: (There *are*other uses besides the trampoline, right? :-) It's easy to come up with use cases where you feed data *into* a generator (parsers and pipelines, for example). I just