I\'m trying to insert a variable mathematical operator into a if statement, an example of what I\'m trying to achieve in parsing user-supplied mathematical expressions:
Use the operator module:
import operator op = operator.eq if op("test", "test"): print "match found"