Ben Finney wrote: > James Stroud <[EMAIL PROTECTED]> writes: > > >>Peter Otten wrote: >> >>>Chris wrote: >>> >>>>I am trying to overload the __invert__ operator (~) such that it >>>>can take a second argument, >>> >>>>>>x ~ x >>> >>> File "<stdin>", line 1 >>> x ~ x >>> ^ >>>SyntaxError: invalid syntax >> >>Seems an arbitrary limitation. Consider >> - x >>and >> x - y > > > Both of which are meaningful syntax in Python, hence the Python parser > accepts them and knows what operations to call on the objects. > > >>Which is inconsistent with limiting ~ to a unary operation. > > > Which is the only Python-meaningful way to use that operator, and > translates to an appropriate call on the object. > > The Python runtime parser is designed to parse Python, not some > arbitrary language that someone chooses to implement in Python. >
You haven't addressed why the limitation isn't arbitrary. You have only told us what we already know. So your argument, therefore, is not one. James -- http://mail.python.org/mailman/listinfo/python-list