Operator Modules

operator

Supply callable forms of Python operations and factories that retrieve attributes/items or invoke methods. Useful when passing an operation as an argument.

Formal Syntax & Structure

python syntaxpython
operator

Return Value

module

Module object accessed through import.

Working Example

Example Snippetpython
import operatorfrom functools import reduceprint(reduce(operator.add,[2,3,4]))
Python Reference