Overloading the tilde operator?

Chris fonnesbeck at gmail.com
Thu Feb 1 13:53:43 EST 2007


I am trying to overload the __invert__ operator (~) such that 
it can take a second argument, other than 
self, so that I can express:

x ~ y

by using:

def __invert__(self, other): <do something>

for example. Is this possible?

Thanks in advance,





More information about the Python-list mailing list