def __rlshift__(self, other):
    return Infix(lambda x, self=self, other=other: self.function(other, x))

def __rshift__(self, other):
    return self.function(other)

def __call__(self, value1, value2):
    return self.function(value1, value2)
andalso = Infix(lambda x, y: x.and_impl(y))
orelse = Infix(lambda x, y: x.or_impl(y))
c = Constraint((x > 10) | andalso | (x < 19) | orelse | (y < 0))
Defining new semantics for expressions in Python