I can\'t understand why Python doesn\'t have a sign function. It has an abs builtin (which I consider sign\'s sister), but no si
Yes a correct sign() function should be at least in the math module - as it is in numpy. Because one frequently needs it for math oriented code.
But math.copysign() is also useful independently.
cmp() and obj.__cmp__() ... have generally high importance independently. Not just for math oriented code. Consider comparing/sorting tuples, date objects, ...
The dev arguments at http://bugs.python.org/issue1640 regarding the omission of math.sign() are odd, because:
-NaNsign(nan) == nan without worry (like exp(nan) )sign(-0.0) == sign(0.0) == 0 without worrysign(-inf) == -1 without worry-- as it is in numpy