How to represent sets

Anton Vredegoor anton at vredegoor.doge.nl
Sat Sep 14 09:22:50 EDT 2002


Hello All,

In the past there have been some discussions on various platforms about
whether sets should be implemented using long integers (possibly leading to
longs becoming iterable arrays of booleans), or by using dictionaries. The
matter seems to be mostly settled and there is a sets.py script in the CVS
directory at sourceforge which uses dictionaries.

I would like to reopen this discussion.

Starting this discussion again when the CVS script is already very mature
seems a bit inappropriate, but I believe there is a way to make sets faster. I
only recently realized this so I could not act earlier.

To give some material for the discussion I am providing a beta version of a
possible implementation af a set class using long integers to represent sets.
It is basically the same script I presented a year ago but I have made several
improvements to this script so that it is now a bit faster, and I hope the
docstring is a bit better now. Please keep in mind this is just a test script,
for a safer and more complete implementation the script in CVS is preferable.

http://home.hccnet.nl/a.vredegoor/universe/universe.py

or the html version:

http://home.hccnet.nl/a.vredegoor/universe/universe.html

Anton.




More information about the Python-list mailing list