I have a list of objects that I want to sort. Each object has an id which is a list of strings.
So I defined:
class MyObject(object):
...
def __cmp__(self, other):
return self.id.__cmp__(other.id)
to which python (2.7) said
object 'list' has no attribute '__cmp__'
So I defined the six 'rich comparison' ... but is there a better way to do it?