Is there a more elegant way to express ((x == a and y == b) or (x == b and y == a))?

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?

If the elements are hashable, you could use sets:

    {a, b} == {y, x}

From: stackoverflow.com/q/58435645