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 <1607495349.24.0.898498329684.issue42456@roundup.psfhosted.org>
In-reply-to
Content
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
10
>>> bin(10)
'0b1010'

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
0

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