What's the priority ranking of numpy bitwise operators & and | ?
if I do
a & b | c
what expression does it evaluate? a & (b | c) ? (a & b) | c ?
How about
a | b & c
I also assume NOT (~) has the highest priority?
Here is a technique that you can use when your internet connection is down. It is applicable to many questions that you might have. The colloquial description of the technique is "Suck it and see".
>>> from itertools import product
>>> list(product(range(2), repeat=3))
[(0, 0, 0), (0, 0, 1), (0, 1, 0), (0, 1, 1), (1, 0, 0), (1, 0, 1), (1, 1, 0), (1, 1, 1)]
>>> all((a & b | c) == ((a & b) | c) for a, b, c in product(range(2), repeat=3))
True
>>> all((a & b | c) == (a & (b | c)) for a, b, c in product(range(2), repeat=3))
False
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With