[Python-Dev] Re: A `cogen' module [was: Re: PEP 218 (sets); moving set.py to Lib]

François Pinard pinard@iro.umontreal.ca
28 Aug 2002 11:50:29 -0400


[Oren Tirosh]

> My implementation from http://www.tothink.com/python/dataflow/xlazy.py:
> [...]  Special-casing the 2 argument case helps a lot.

Good idea!  I added such speed-up code for cartesians, subsets and
permutations, and am now seeking how to do it (nicely) for combinations
and arrangements as well.

> Slurping the tail into a list loses the lazy efficiency of this function.

Generators are an elegant way to be lazy.  I agree that we are likely to
loose something if we attempt to do too much, too soon.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard