Awesome! Perfect!
Thanks
Janto
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> I not only want to compare class *instances* but also the classes
> themselves. Something like:
> sorted([B, A]) => [A, B]
>
> My motivation for doing so is simply to sort classes based on their
> names and not (as it seems is the default behaviour) on the order in
>
I not only want to compare class *instances* but also the classes
themselves. Something like:
class T(object):
@classmethod
def __cmp__(cls, other):
return cmp(cls.__name__, other.__name__)
@instancemethod
def __cmp__(self, other):
return cmp(self.x, other.x)
class