[Python-ideas] Yield-from: Details to be decided
Guido van Rossum
guido at python.org
Fri Feb 20 23:30:13 CET 2009
In general .send() is picky when it knows for sure the value won't be
used -- try .send() on a generator suspended before the first time it
yields, that raises an exception too. So yes, an exception, please.
(Doesn't the PEP specify this? I told you it would be useful to start
coding. :-))
--Guido
On Fri, Feb 20, 2009 at 2:15 PM, Jesse Noller <jnoller at gmail.com> wrote:
> Raising an exception seems more sane right now
>
> On Feb 20, 2009, at 5:15 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>
>> I've got to the point in the implementation where I
>> need to decide what to do if you send() a value to
>> a generator that's delegating to something that
>> doesn't have a send() method.
>>
>> Possibilities include:
>>
>> * Ignore the value and call next() instead
>>
>> * Raise an exception
>>
>> What do people think? I'm inclined to raise an
>> exception for the time being, since we can always
>> relax it later if we want. Also, doing so is more
>> consistent with the idea of the caller talking
>> directly to the sub-iterator.
>>
>> --
>> Greg
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> http://mail.python.org/mailman/listinfo/python-ideas
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-ideas
mailing list