[Python-Dev] Return from generators in Python 3.2 (original) (raw)

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Aug 28 02:19:03 CEST 2010


Ron Adam wrote:

I wonder if "yield from" may run into pythons stack limit?

My current implementation wouldn't, because nested yield-froms don't result in nested activations of Python frames. But...

if name == "main": print(factoral(10000)) # <---- extra zero too!

But if I add another zero, it begins to slow to a crawl as it uses swap space. ;-) How would a "yield from" version compare?

... there is still a Python frame in existence for each active invocation of the generator, so it would probably use about the same amount of memory.

-- Greg



More information about the Python-Dev mailing list