Fast powerset function

Paul Rubin http
Fri Jul 13 11:25:59 CEST 2007

Antoon Pardon <apardon at> writes:
> On 7/12/07, Arash Arfaee <Arash at> wrote:
> > I need a powerset generator function. It's really slow with recursion. Does
> > anybody have any idea or code(!!) to do it in an acceptable time?
> My idea would be the following. ...
> 3) let n range from 0 to 2 ** lng

That may help a little but my guess is the slowness comes from
the size (2**n) of the power set.

More information about the Python-list mailing list