only hashable objects may be added to set hashable objects are objects which have __hash__(special method whose return value is always the same throughout the object' lifetimeand which can be compared for equality using the __eq__(special method (special methods--methods whose name begins and ends with two underscores--are covered in all the built-in immutable data typessuch as floatfrozensetintstrand tupleare hashable and can be added to sets the built-in mutable data typessuch as dictlistand setare not hashable since their hash value changes depending on the items they containso they cannot be added to sets set types can be compared using the standard comparison operators (<<===!=>=>note that although =and !have their usual meaningswith the comparisons being applied item by item (and recursively for nested items such as tuples or frozen sets inside sets)the other comparison operators perform subset and superset comparisonsas we will see shortly |sets set is an unordered collection of zero or more object references that refer to hashable objects sets are mutableso we can easily add or remove itemsbut since they are unordered they have no notion of index position and so cannot be sliced or strided figure illustrates the set created by the following code snippets { "veil" - (" " )"sun"frozenset({ }) - (' ' frozenset({ }'sun'veil figure set is an unordered collection of unique items the set data type can be called as functionset()--with no arguments it returns an empty setwith set argument it returns shallow copy of the argumentand with any other argument it attempts to convert the given object to set it does not accept more than one argument nonempty sets can also be created without using the set(functionbut the empty set must be created shallow and deep copying