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 tim.peters
Recipients Kshitish, tim.peters
Date 2020-12-09.06:29:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Please ask for help on StackOverflow or the general Python mailing list. Your understanding of the operations is incorrect.

"&" is NOT a logical operator ("and" is). It's a bitwise operator on integers.

>>> 10 & 10
>>> bin(10)

The last bit is 0, so when you "&" the result with True (which is equivalent to integer 1) the result is 0:

>>> (10 & 10) & True

and the integer 0 is treated as False in a Boolean context.
Date User Action Args
2020-12-09 06:29:09tim.peterssetrecipients: + tim.peters, Kshitish
2020-12-09 06:29:09tim.peterssetmessageid: <>
2020-12-09 06:29:09tim.peterslinkissue42456 messages
2020-12-09 06:29:08tim.peterscreate