[issue45230] Something wrong when Calculate "3==3 is not True"

Serhiy Storchaka report at bugs.python.org
Fri Sep 17 05:06:22 EDT 2021


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

No, it is a feature.

Python allows you to chain comparison operations, so you can write 0 < x <= 10 which is equivalent to (0 < x) and (x <= 10).

And "is" is a comparison operation. So `3==3 is not True` is equivalent to `(3==3) and (3 is not True)` which is evaluated to `True and True` which is equal to True.

----------
nosy: +serhiy.storchaka
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45230>
_______________________________________


More information about the Python-bugs-list mailing list