4 ms·
Bitwise or works at the level of bits, so the question is more like, in: >>> bin(0b011 | 0b010) '0b11' Does the leading 1 come from the first argument
by DougBTX 6y ago
Bitwise or works at the level of bits, so the question is more like, in:
>>> bin(0b011 | 0b010)
'0b11'
Does the leading 1 come from the first argument or the second argument? It isn't really a sensible question for bits, since the 1s are indistinguishable. However the values in the hash table are distinguishable, so it's a valid question.
Also, taking an example from another comment:
>>> {0} | {False}
{0}
>>> {False} | {0}
{False}
This is another example where the union operator is used, but here it picks the first value, rather than the second value.
- quietbritishjim 6y agoOuch, that is pretty nasty.