[Python-3000] Is __cmp__ deprecated?

Paul Moore p.f.moore at gmail.com
Thu Aug 23 17:55:08 CEST 2007


On 23/08/07, Guido van Rossum <guido at python.org> wrote:
> Coerce is definitely dead.
>
> cmp() is still alive and __cmp__ is used to overload it; on the one
> hand I'd like to get rid of it but OTOH it's occasionally useful. So
> it'll probably stay. However, to overload <, == etc. you *have* to
> overload __lt__ and friends.

Thanks. In particular, thanks for the comment about overloading < etc
- that's what I was looking at, and I was wondering about using
__cmp__ to save some boilerplate. You saved me some headaches!

Paul.


More information about the Python-3000 mailing list