This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients Antelx, steven.daprano
Date 2021-07-28.09:10:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1627463448.83.0.376214237424.issue44758@roundup.psfhosted.org>
In-reply-to
Content
Hi Antel, thank you for your submission but this is not a bug. This is a bug tracker for reporting bugs, not a help desk to ask for help understanding code. There are many forums where you can ask for help, I suggest that you could try places like the Python-List mailing list or Reddit.

https://mail.python.org/mailman/listinfo/python-list

https://www.reddit.com/r/learnpython/


The three code snippets you show are all correct.

In the first case, you are comparing True != 3, which is True, and then testing whether True is in [3], which it is not.

In the second you compute (3 in [3]), which is True, then test True != True, which is False.

Lastly you do a *chained comparison* `True != 3 in [3]` which is equivalent to `(True != 3) and (3 in [3])` which is True.
History
Date User Action Args
2021-07-28 09:10:48steven.dapranosetrecipients: + steven.daprano, Antelx
2021-07-28 09:10:48steven.dapranosetmessageid: <1627463448.83.0.376214237424.issue44758@roundup.psfhosted.org>
2021-07-28 09:10:48steven.dapranolinkissue44758 messages
2021-07-28 09:10:48steven.dapranocreate