Py2.3: Feedback on Sets (fwd)

David Mertz mertz at
Sat Aug 16 18:26:22 CEST 2003

> * Is there a compelling need for additional set methods like
>    Set.powerset() and Set.isdisjoint(s) or are the current
>    offerings sufficient?

I confess that I have not used sets for anything beyond testing.  I love
the concept, but I just haven't had the need yet (especially in
something where I want to require 2.3).

The mention of Set.powerset() above is quite interesting to me.  It
feels both exciting and dangerous :-).

As we all know, the size of the powerset of S, for len(S)==N, is 2**N.
Seems like it would be really easy to run into some long runtimes and
memory usage.  Then again, power set really is a fundamental operation
on sets.  And making users rewrite it each time is error prone.

So I think I would advocate it, but with a fairly harsh warning in the
documentation about complexity issues.

Yours, David...

mertz@  | The specter of free information is haunting the `Net!  All the
gnosis  | powers of IP- and crypto-tyranny have entered into an unholy
.cx     | alliance...ideas have nothing to lose but their chains.  Unite
        | against "intellectual property" and anti-privacy regimes!
X-Shameless-Plug:  Buy Text Processing in Python:

More information about the Python-list mailing list