[Python-ideas] Revised revised revised PEP on yield-from

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Feb 15 04:58:12 CET 2009

Bruce Leban wrote:
> I'd like to understand better what this function would do:
>     def generate_concatenate(generator_list):
>         for g in generator_list:
>             yield from g
> in particular, what does generator_concatenate.close() do?

If it happens to be in the midst of iterating over
one of the generators from the list at the time
(i.e. executing the 'yield from') then that generator
is finalized, then generate_concatenate itself is finalized.

Otherwise, nothing special happens.

More information about the Python-ideas mailing list