Module sets :: Class Set
[hide private]
[frames] | no frames]

type Set

object --+    
         |    
   BaseSet --+
             |
            Set

Mutable set class.

Instance Methods [hide private]
 
__init__(self, iterable=None)
Construct a set from an optional iterable.
 
__getstate__(self)
 
__setstate__(self, data)
 
__hash__(self)
A Set cannot be hashed.
 
__ior__(self, other)
Update a set with the union of itself and another.
 
union_update(self, other)
Update a set with the union of itself and another.
 
__iand__(self, other)
Update a set with the intersection of itself and another.
 
intersection_update(self, other)
Update a set with the intersection of itself and another.
 
__ixor__(self, other)
Update a set with the symmetric difference of itself and another.
 
symmetric_difference_update(self, other)
Update a set with the symmetric difference of itself and another.
 
__isub__(self, other)
Remove all elements of another set from this set.
 
difference_update(self, other)
Remove all elements of another set from this set.
 
update(self, iterable)
Add all values from an iterable (such as a list or file).
 
clear(self)
Remove all elements from this set.
 
add(self, element)
Add an element to a set.
 
remove(self, element)
Remove an element from a set; it must be a member.
 
discard(self, element)
Remove an element from a set if it is a member.
 
pop(self)
Remove and return an arbitrary set element.
 
__as_immutable__(self)
 
__as_temporarily_immutable__(self)

Inherited from BaseSet: __and__, __cmp__, __contains__, __copy__, __deepcopy__, __eq__, __ge__, __gt__, __iter__, __le__, __len__, __lt__, __ne__, __or__, __repr__, __str__, __sub__, __xor__, copy, difference, intersection, issubset, issuperset, symmetric_difference, union

Inherited from BaseSet (private): _binary_sanity_check, _compute_hash, _repr, _update

Properties [hide private]

Inherited from BaseSet (private): _data

Method Details [hide private]

__init__(self, iterable=None)
(Constructor)

 

Construct a set from an optional iterable.

Overrides: BaseSet.__init__

__hash__(self)
(Hashing function)

 

A Set cannot be hashed.

Overrides: object.__hash__

add(self, element)

 

Add an element to a set.

This has no effect if the element is already present.

remove(self, element)

 

Remove an element from a set; it must be a member.

If the element is not a member, raise a KeyError.

discard(self, element)

 

Remove an element from a set if it is a member.

If the element is not a member, do nothing.