s.add ([10]) works as documented. An exception occurs because [10] is not hashed.
No magic happens during initialization.
set ([0,1,2,3,4,5,6,7,8,9]) has the same effect as set (range (10)), and sets (xrange (10)) and sets ( foo ()) where
def foo(): for i in (9,8,7,6,5,4,3,2,1,0): yield i
In other words, the arg argument must be iterable, and each of the values ββobtained from the iterable must be hashed.
source share