[Python-ideas] Revised**5 PEP on yield-from

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Feb 21 10:23:14 CET 2009


Jacob Holm wrote:

>> One problem is that if the generator gets None from
>> a yield, it has no way of knowing whether it came from
>> a next() or a send(None), 
> This is only a problem with the recursive implementation though, isn't it?

It's a problem when trying to specify the semantics
in terms of an expansion into currently valid Python.
It's not necessarily a problem in the actual
implementation, which isn't constrained that way.

> I still (see example in another thread) think that a missing 'send' 
> should be
> treated as a 'next'. To me, the "communicating directly with the caller" 
> bit
> is less important than the argument that the caller is still talking to a
> generator that *has* a send but may ignore the values sent.

Yes, I'm starting to think that way, too.

-- 
Greg



More information about the Python-ideas mailing list