I tried to define a class and override the tilde operator:
class foo:
def __invert__(self, other)
return 1232 # a random number , just as test
Then calling it like:
>>> f = foo()
>>> g = foo()
>>> f ~ g
File "<input>", line 1
f ~ g
^
SyntaxError: invalid syntax
Can we replace the tilde operator with a binary one so we can do an operation like f ~ g
without raising a syntax error.