Python Operator Module
Operator functions — add, mul, itemgetter, attrgetter, methodcaller. This category documents 6 Python operator module entries, and each page gives you the full syntax, the parameter list, the return value, and a runnable example. The entries include: operator.add(), operator.sub(), operator.mul(), operator.itemgetter(), operator.attrgetter(), operator.methodcaller(). operator.add() returns a + b (addition). Useful with reduce and map. operator.sub() returns a - b (subtraction). operator.mul() returns a * b (multiplication). operator.itemgetter() returns a callable that fetches the specified item(s) from its operand. operator.attrgetter() returns a callable that fetches the specified attribute(s) from its operand. Operator Module belongs to the Collections & Iteration group alongside Collections Module, Itertools Module, Functools Module, Bisect Module. You can also search across every category from the search page, browse the complete A–Z index, or try any example in the Python playground.