[Python-ideas] Cofunctions - Back to Basics

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Oct 29 08:16:53 CEST 2011


Nick Coghlan wrote:
> This means that, whenever a generator yields, that stack
> needs to be unwound, suspending each affected generator in turn,
> strung together by references between the generator objects rather
> than remaining a true frame stack.

The chain of generator frames that results from nested yield-from
calls *is* a stack of frames -- it's just linked in the opposite
order from the way frames are usually arranged. The "top" of the
stack is at the tail, making it slightly less convenient to get
to, but that's just an issue of implementation efficiency.

-- 
Greg



More information about the Python-ideas mailing list