PEP 255: Simple Generators

Roman Suzi rnd at onego.ru
Sun Jun 24 09:20:03 EDT 2001


On Sun, 24 Jun 2001, Tim Peters wrote:

>natural.  For example, "how do I generate the elements of a list taken k at
>a time?" is almost a c.l.py FAQ, and generators are ideal for that kind of
>thing:
>
>def gcomb(x, k):
>    "Generate all combinations of k elements from list x."
>
>This *kind* of example doesn't appeal to everyone, of course, but I already
>covered my butt by saying it depends on the audience and the author <wink>.

This implementation is cool, but how fast will be recursive generators?
How large is the overhead to defrost execution frame each time? Will it be
faster than functional gcomb?

Sincerely yours, Roman Suzi
-- 
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Sunday, June 24, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "Ok, I pulled the pin. Now what? Where are you going?" _/





More information about the Python-list mailing list