Use this function to create a set value. Here
are the general forms:
set()
set(S)
When called with no arguments, this function returns a new,
empty set. To build a set from an existing sequence , use the second form.
Examples:
S
>>> empty = set() >>> empty set([]) >>> len(empty) 0 >>> swallows=set(['African', 'European']) >>> swallows set(['European', 'African']) >>> len(swallows) 2 >>> set ( (0, 0, 0, 58, 0, 0, 58, 17) ) set([0, 17, 58])
For more information about sets, see Section 8, “Types set and frozenset:
Set types”.