I'm building a DSL for form validation in Python, and one of the requirements is to be able to specify that a field should be greater than or less than a constant or another field value. As a result, I'm trying to easily map operators like <, >, <= and >= to their equivalent functions in the operator module, so that they can be called during field validation.
I realise I could just create a dictionary to map the operator to the function, but is there a nicer way to do it? Is there any way to access Python's built-in mapping?