I'm trying to evaluate ((x == a and y == b) or (x == b and y == a)) in Python, but it seems a bit verbose. Is there a more elegant way?
((x == a and y == b) or (x == b and y == a))
If the elements are hashable, you could use sets:
{a, b} == {y, x}