Jan Vroonhof wrote: > > def __cmp__(self,other): > return self.nospaces() == other.nospaces() A __cmp__ function is supposed to return -1, 0 or 1 corresponsing to less than, equal to or greater than. Try it this way: def __cmp__(self,other): return cmp(self.nospaces(), other.nospaces()) Greg