Tim Peters <t...@python.org> added the comment:

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

----------
nosy: +tim.peters
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42456>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to