On Mar 12, 6:52 pm, Alan Isaac <[EMAIL PROTECTED]> wrote:
> Paul Rubin wrote:
> > The cmp option should not be removed.  However, requiring
> > it to be specified as a keyword parameter instead of just
> > passed as an unlabelled arg is fine.
>
> Sure; I would have no problem with that.
>
> But that is not what is happening.
>
> As for Carl's suggestion to use ``key``:
> this is already possible when it is convenient,
> but it is not always convenient.  (Even aside
> from memory considerations.)

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
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to