Infix Operators#
Infix operators allow for a fancy way of defining binary operations using the operators ‘<<’, ‘>>’ and ‘|’.
- class dewloosh.core.infix.Infix(function: Callable)#
Implements a custom Infix operator using the operators ‘<<’, ‘>>’ and ‘|’.
Example
>>> x = Infix(lambda x, y: x * y) >>> print(2 | x | 4) 8
>>> x = Infix(lambda x, y: x + y) >>> print(2 << x >> 4) 6