On Sun, Dec 13, 2009 at 3:09 PM, Steven D'Aprano <st...@remove-this-cybersource.com.au> wrote: > On Sun, 13 Dec 2009 10:48:11 -0800, Fire Crow wrote: > >> You could also define a custom object that manages a custom ordered set > [...] >> I've used this on a few projects, it makes for wonderfully clean code, >> because you can look at your program as an overview without all the >> arithmetic behind it. > > Which is all very good, but beware that your "ordered set" implementation > is O(N) for insertions, which may be slow once the set grows large enough. > > Also, I'm not sure I like your abuse of the + operator to modify the > object in place and return a flag. It is an API not shared by (as far as > I can see) any other data type in Python.
Could probably just abuse an odict as cleanly. The other option that leaps to mind is to use a bloom filter and a list. Geremy Condra -- http://mail.python.org/mailman/listinfo/python-list