In operators
module we have a helper method operator.abs
. But in python abs
is already a function, and the only way I know to invoke the __abs__
method on an object is by function call anyway.
Is there some other fancy way I don't know about to take the absolute value of a number? If not, why does operator.abs
exist in the first place, and what is an example where you would have to use it instead of plain old abs
?