[issue11549] Rewrite peephole to work on AST

Daniel Urban report at bugs.python.org
Sun Mar 27 18:26:12 CEST 2011


Daniel Urban <urban.dani+py at gmail.com> added the comment:

> not x == 2 can be theoretically optimized to x != 2, ...

I don't think it can:

>>> class X:
...     def __eq__(self, other):
...             return True
...     def __ne__(self, other):
...             return True
... 
>>> x = X()
>>> 
>>> not x == 2
False
>>> x != 2
True
>>>

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11549>
_______________________________________


More information about the Python-bugs-list mailing list