Python: what's the difference - abs and operator.abs
Question: In python what is the difference between :

`abs(a)` and `operator.abs(a)`

They are the very same and they work alike. If they are the very same then why
are two separate functions doing the same stuff are made??

If there is some specific functionality for any one of it - please do explain
it.


Answer: There is no difference. The documentation even says so:

    
    
    >>> import operator
    >>> print(operator.abs.__doc__)
    abs(a) -- Same as abs(a).
    

It is implemented as a wrapper just so the documentation can be updated:

    
    
    from builtins import abs as _abs
    
    # ...
    
    def abs(a):
        "Same as abs(a)."
        return _abs(a)
    

(Note, the above Python implementation is only used if the [C module
itself](https://hg.python.org/cpython/file/v3.5.1/Modules/_operator.c#l78)
can't be loaded).

It is there _purely_ to complement the other (mathematical) operators; e.g. if
you wanted to do dynamic operator lookups on that module you don't have to
special-case `abs()`.

