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
sign
abs
si
It just doesn't.
The best way to fix this is:
sign = lambda x: bool(x > 0) - bool(x < 0)