I\'m speaking of this module: http://docs.python.org/library/operator.html
From the article:
The operator module exports a set of functions
I cannot remember the exact use case but I had a requirement somewhere that needed to do some calculation dynamically and this could be using a different operator depending on where it came from.
A very simple example is this:
import operator
def add_or_subtract(x, y, op):
return op(x, y)
x = 3
y = 10
o = operator.add #operator.sub
add_or_subtract(x, y, o)