[Python-ideas] Revised revised revised PEP on yield-from

Bruce Leban bruce at leapyear.org
Tue Feb 17 20:23:00 CET 2009


Reading the last few messages what came to mind was 'yield to'. In the
coroutine contexts it might be more appropriate thinking of yielding
execution 'to' the other generator. But in other contexts it seems more
appropriate to think of yielding values 'from' the other generator. Of
course it does both of these things. And 'yield from' makes more sense to
me.

It reminds me of a Honeymooners skit with Ralph and Ed arguing about the
doors between two rooms labeled 'in' and 'out'.

Ralph: "You are supposed to go in the door marked 'In.'"

Ed: "I wasn't going in that room. I was coming out of this room."

Ralph: "You were not going out of this room. You were going in that
room."

Ed: "How could I go into that room without coming out of this room?"

--- Bruce



On Tue, Feb 17, 2009 at 1:04 AM, Greg Ewing <greg.ewing at canterbury.ac.nz>wrote:

> Guillaume Chereau wrote:
>
>  In the context of a coroutine, 'yield from' means : "we start this
>> other coroutine, and return to the current coroutine when it is done",
>> and I was expecting the syntax to somehow express this idea.
>>
>
> For what it's worth, I tend to feel the same way.
> I was originally going to call it 'call':
>
>  y = call g(x)
>
> but Guido convinced me that 'call' is far too generic
> a word and doesn't convey any connection with generators
> at all.
>
> If anyone has any other suggestions, I'll gladly
> consider them.
>
> --
> Greg
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090217/e3a58561/attachment.html>


More information about the Python-ideas mailing list