[Python-3000] Please re-add cmp to python 3000 (original) (raw)

Aahz aahz at pythoncraft.com
Wed Oct 17 21:25:32 CEST 2007


On Wed, Oct 17, 2007, Steven Bethard wrote:

I'm having troubles coming up with things where the basic operator is really a cmp-like function. Even in your example, the cmp function was defined in terms of "less than". If the basic operator is really "less than", then why define a cmp() function at all?

From my perspective, the real use case for cmp() is when you want to do a three-way comparison of a "large" object (for example, a Decimal instance). You can store the result of cmp() and then do a separate three-way branch.

Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/

The best way to get information on Usenet is not to ask a question, but to post the wrong information.



More information about the Python-3000 mailing list