Boolean operators vs Bitwise operators
Here are a couple of guidelines: Boolean operators are usually used on boolean values but bitwise operators are usually used on integer values. Boolean operators are short-circuiting but bitwise operators are not short-circuiting. The short-circuiting behaviour is useful in expressions like this: if x is not None and x.foo == 42: # … This would … Read more