Skip to content

Latest commit

 

History

History
15 lines (11 loc) · 981 Bytes

File metadata and controls

15 lines (11 loc) · 981 Bytes

Sets

A set is a mutable and unordered collection of hashable objects. Items within a set are unique, and no duplicates are allowed. Like most collections, sets can hold any (or multiple) data type(s) -- as long as those types can be hashed. Sets also come in an immutable frozenset flavor.

Like other collection types, sets support membership testing through in, length calculation through len(), shallow copies through copy(), & iteration via for item in <set>. Unlike sequence types (string, list & tuple), sets are neither ordered nor indexed, and do not support slicing, sorting, or other sequence-type behaviors.

sets are most commonly used to quickly dedupe groups of items.