On Mar 13, 12:38 pm, Alan Isaac <[EMAIL PROTECTED]> wrote: > 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.)
It won't. In Python 3.0 you'd have to write this class in terms of rich comparisons (__lt__, __gt__, etc.). Carl Banks -- http://mail.python.org/mailman/listinfo/python-list