18653, "bmcdonald3", "Decide how set operators should decide which operand is chosen ", "2021-10-28T22:43:26Z"
In the case of a | b
(union) where a
and b
are both sets, there could potentially be a case where an object from set a
is ==
equivalent to an object in set b
, but not ===
equivalent. In this case, the set method needs to choose if either the RHS or LHS operand will "win" and make it into the resulting set.
Python uses the element from the RHS, but our current implementation (inadvertently) chooses the element from the LHS.
A conscious decision should be made regarding this and then documented so that a user would be aware and any changes would not be breaking from changing which operand is chosen by accident. Another possible option is to add a warning that the left hand side is always chosen, for example.