Set
Applies to: general, python
A set is an unordered collection of unique elements with fast membership tests (O(1) average, like a hash
map without values). Use it to deduplicate or to ask "is x in here?".
seen = set()
seen.add(3); seen.add(3) # stored once
3 in seen # True