no more comparisons

Alan Isaac aisaac at american.edu
Thu Mar 13 12:38:33 EDT 2008


Dan Bishop wrote:

> def cmp_key(cmp_fn):

>     class CmpWrapper(object):

>         def __init__(self, obj):

>             self.obj = obj

>         def __cmp__(self, other):

>             return cmp_fn(self.obj, other.obj)

>     return CmpWrapper



Apparently I'm overlooking something obvious ...

how is this supposed to work if __cmp__ is no longer

being called?  (Which was my understanding.)



Thank you,

Alan Isaac







More information about the Python-list mailing list