On Tue, May 18, 2010 at 11:13:42PM +0100, Gustavo Narea wrote: > To sum up, it would behave like a tuple or a list, except when it's compared > with another object: They would be equivalent if they're both unordered > tuples/lists, and have the same elements. There can be mutable and immutable > editions (UnorderedList and UnorderedTuple, respectively). class UnorderedList(list): def __eq__(self, other): if not isinstance(other, UnorderedList): return False return sorted(self) == sorted(other) def __ne__(self, other): return not self.__eq__(other) Do you need more than that? Oleg. -- Oleg Broytman http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4