This python module, demset, fully implements the builtin Python set and frozenset classes introduced in Python 2.4, but which will work in Python 2.2 and 2.3. This implementation is very close to that of Python 2.4, and should be able to be substituted for almost all purposes.

Use

Using this module is incredibly easy. To help insure that code you write will work correctly on any version of Python, you should import my module as follows:

try:
    type(frozenset)
except NameError:
    from demset import set, frozenset

Then, if your program is run under Python 2.4 or later, the native built-in set types will be used; but when under Python 2.2 or 2.3, my implemention will be used.

See also

Also of interest may be the official Python set and frozenset documentation.

License

I am releasing this code as Open Source, under the same license terms as Python 2.2 or any later version (see www.python.org).