3 ms·
It's a hack using a single character binary operator and the way it's implemented for the type that serves as the main “operator” on between the paired use. >
by dragonwriter 5y ago
It's a hack using a single character binary operator and the way it's implemented for the type that serves as the main “operator” on between the paired use.
> Where is this documented
Insofar as it is, on the page linked. The underlying operator overloading mechanism that his leverages is documented in the official Python docs.
- CornCobs 5y agoOHHH. Looking at the Infix class carefully I realize it's not actually |add| as a single operator but using the right or __ror__ to partially apply the function, then using the left or __or__ to fully apply it. Wrapping it up in a decorator class is really neat!