overlapping sets

Alex Martelli aleaxit at yahoo.com
Sat Mar 25 10:51:42 EST 2006


Lonnie Princehouse <finite.automaton at gmail.com> wrote:

> There is a sets.Set class built in to Python.  You might want to use

In 2.4, there's also a set builtin type -- you can keep using the sets
module from the standard library, but the built-in set is faster.

If you need compatibility with both 2.3 and 2.4, getting the best set
implementation available in each case, the common idiom is:

try:
    set
except NameError:
    from sets import Set as set

The interface to use the set type/class is the same in either case.


Alex



More information about the Python-list mailing list