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-11-25.04:56:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1606280188.69.0.477760221318.issue42456@roundup.psfhosted.org>
In-reply-to
Content
There's no bug here.

"&" is the bitwise Boolean logical-and operator on integers. For example,

>>> 1 & 2
0
>>> 1 & 3
1

It binds more tightly than the "==" equality-testing operator. To get the result you want, you would need to add more parentheses to override the natural operator precedence:

>>> (a == 10) & (not(a!=b)) & (b == 10)
True

But, more to the point, what you probably really want is the "and" logical operator, not the bitwise integer "&" operator:

>>> a == 10 and (not(a!=b)) and b == 10
True
History
Date User Action Args
2020-11-25 04:56:28tim.peterssetrecipients: + tim.peters, Kshitish
2020-11-25 04:56:28tim.peterssetmessageid: <1606280188.69.0.477760221318.issue42456@roundup.psfhosted.org>
2020-11-25 04:56:28tim.peterslinkissue42456 messages
2020-11-25 04:56:28tim.peterscreate