[Python-ideas] Yield-From Example 2: Scheduler

Adam Olsen rhamph at gmail.com
Fri Feb 20 06:07:20 CET 2009


On Thu, Feb 19, 2009 at 6:47 PM, Guido van Rossum <guido at python.org> wrote:
> On Thu, Feb 19, 2009 at 5:33 PM, Adam Olsen <rhamph at gmail.com> wrote:
>> On Thu, Feb 19, 2009 at 6:04 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>>> So there perhaps isn't a very strong case for using 'yield
>>> from' in a scheduler setting. However it still illustrates
>>> the utility of being able to return a value from a generator,
>>> since otherwise you would either have to explicitly raise
>>> the StopIteration or resort to some convention such as
>>> yield Call(g)/yield Return(x).
>>
>> If you can propose semantics for return that don't risk silently
>> eating values then I'll at least gives -0.  Until then I'm -1.
>
> Can you explain why you feel so strongly about this? As has been
> pointed out, returned values are routinely ignored in Python, it is
> not an error.

It's more of a gut instinct thing.  It'd be hard to make ignored
returns into an error, but it's easy here.


-- 
Adam Olsen, aka Rhamphoryncus



More information about the Python-ideas mailing list