A symmetric difference contains values found on exactly one side. It works well for comparing membership snapshots where multiplicity is irrelevant.
Worked example
print(sorted({1, 2, 3} ^ {2, 3, 4}))Result
[1, 4]Implementation notes
Sets do not preserve the business ordering of two feeds. If a report requires a stable order, sort the resulting identifiers using an explicit key.
Try it yourself
Repeat one value in the incoming list before converting it to a set.
Open the Python example →Editorial date May 22, 2026 · Published December 6, 2026