[Python-Dev] problem with recursive "yield from" delegation

Mark Shannon mark at hotpy.org
Thu Mar 8 14:45:20 CET 2012


Nick Coghlan wrote:
> On Thu, Mar 8, 2012 at 9:52 PM, Mark Shannon <mark at hotpy.org> wrote:
>> First of all, the semantics described in the PEP do not match the tests.
>> If you substitute the supposedly semantically equivalent code
>> based on normal yields for each yield from in the test code
>> (Lib/test/test_pep380.py) and run it, then it fails.
> 
> What's more important is whether or not it matches the semantics of
> inlining the subgenerator bodies. The expansion in the PEP was an
> attempt to define a way to achieve that in current Python without
> interpreter support.

So "yield from X" means "inline X here", if X is a generator.
That is much, much easier to understand than the big block of
code in the PEP.
It really ought say that "yield from" is equivalent to inlining
in the PEP.

Cheers,
Mark



More information about the Python-Dev mailing list