[Python-3000] Please re-add __cmp__ to python 3000
steven.bethard at gmail.com
Wed Oct 31 04:22:08 CET 2007
On 10/30/07, Adam Olsen <rhamph at gmail.com> wrote:
> > I'm actually currently in favor of keeping __cmp__ as it is in Python
> > 2.5. If a class defines only __cmp__, Python will do the appropriate
> > dance to make <, >, ==, etc. work right. If a class defines only
> > __eq__, __lt__, etc. Python will do the appropriate dance to make
> > cmp() work right.
> For some definition of "right". A container defines only __cmp__,
> using cmp() internally, will be broken in 3.0.
Sure, but that's their choice. If you don't want to raise exceptions
on equality comparisons, then you should define __eq__, in addition to
__cmp__. Or you should only compare against comparable things.
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
--- Bucky Katt, Get Fuzzy
More information about the Python-3000