set

Python's built-in unordered collection of unique items, implemented as a hash table that stores keys without values.

In more detail

Checking whether an item is in a set costs O(1) on average, against O(n) for a list, which makes sets the right tool for membership tests and duplicate removal. Items must be hashable. Sets cannot answer range queries or give items in sorted order.

Related terms

Taught in

References