Chris wrote: > 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?
No, you will get a syntax error before python even look up the names: >>> x Traceback (most recent call last): File "<stdin>", line 1, in ? NameError: name 'x' is not defined >>> x ~ x File "<stdin>", line 1 x ~ x ^ SyntaxError: invalid syntax Peter -- http://mail.python.org/mailman/listinfo/python-list