[Python-3000] Is __cmp__ deprecated?

Aahz aahz at pythoncraft.com
Fri Aug 24 15:02:52 CEST 2007


On Fri, Aug 24, 2007, Greg Ewing wrote:
> Guido van Rossum wrote:
>>>> 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.
>> Maybe you could keep cmp() but implement it in terms of, say, __lt__
> and __eq__?

No! The whole point of cmp() is to be able to make *one* call; this is
especially important for things like Decimal and NumPy.
-- 
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"If you don't know what your program is supposed to do, you'd better not
start writing it." --Dijkstra


More information about the Python-3000 mailing list

AltStyle によって変換されたページ (->オリジナル) /