from functools import partial
class apply(partial):
def __matmul__(self, argv):
return self(argv)
def __rmatmul__(self, argv):
return self(argv)
p = apply(print)
>>> p@p
apply(<built-in function print>)
Python tries to parse p @ p as p.__matmul__(p) and raises TypeError if it is not found. This issue? seems to occur when the left and the right operand are the same types. I expected python to resolve this as p.__rmatmul__(p) if __matmal__ is not found.