performance of recursive generator

Terry Reedy tjreedy at udel.edu
Thu Aug 11 14:11:12 EDT 2005


"aurora" <aurora00 at gmail.com> wrote in message 
news:op.svbscwmx6yt6e7 at news.cisco.com...
>I love generator and I use it a lot. Lately I've been writing some
> recursive generator to traverse tree structures. After taking closer look
> I have some concern on its performance.

When the stacked yields become a measureable problem over the anticipated 
future use of the code, then you can rewrite the obviously correct 
recursive generator as a less-obviously correct iterative generator, using 
the first to generate test results to check the second.

Terry J. Reedy






More information about the Python-list mailing list