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
The reason "sign" is not included is that if we included every useful one-liner in the list of built-in functions, Python wouldn't be easy and practical to work with anymore. If you use this function so often then why don't you do factor it out yourself? It's not like it's remotely hard or even tedious to do so.