Would there be support for a more general cmp/__cmp__

Antoon Pardon apardon at forel.vub.ac.be
Mon Oct 31 03:56:09 EST 2005


Op 2005-10-28, Ron Adam schreef <rrr at ronadam.com>:
>
> I haven't heard he was removing __cmp__,

I read somewhere he was considering it.

> but I would think the sort or 
> sorted functions would just use the available comparisons methods or 
> equivalent C code for base types.  So I expect it would only matter if 
> you need a custom or modified sort.
>
> Although It is a thought that these cases could be improved by making 
> the sort value available to the underlying C sort function.  Something 
> on the order of:
>
>      __sortvalue__ == self.value.

I doubt that will be possible in general. You can't even calculate such
a __sortvalue__ for lists.

-- 
Antoon Pardon



More information about the Python-list mailing list