3 ms·
b|c for sets is commutative; b|c for dictionaries is not. | is not strictly required to commute, but a | operator that does not commute is surprising behavior,
by JoshTriplett 11y ago
b|c for sets is commutative; b|c for dictionaries is not. | is not strictly required to commute, but a | operator that does not commute is surprising behavior, and Python doesn't favor surprising behavior.
- kbd 11y agoThanks! That's exactly what I figured was the reason. Personally I'd have gone for the practicality beats purity side of things here, but oh well.
- azernik 11y agoI think this is a practicality concern; specifically, with regards to the UI, and following the rule of least surprise to keep user (i.e. programmer) confusion down.