[Python-Dev] PEP 550 v4 (original) (raw)

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Aug 28 18:56:00 EDT 2017


Yury Selivanov wrote:

I saying that the following should not work:

def nestedgen(): setsomecontext() yield def gen(): # somecontext is not set yield from nestedgen() # use somecontext ???

And I'm saying it should work, otherwise it breaks one of the fundamental principles on which yield-from is based, namely that 'yield from foo()' should behave as far as possible as a generator equivalent of a plain function call.

-- Greg



More information about the Python-Dev mailing list