| | |
- __builtin__.object
-
- frozenset
-
- set
class frozenset(__builtin__.object) |
| |
An immutable set, an unordered collection of elements.
You can build one of these by passing in any sequence or iterable
as the argument to the constructor. Note that only hashable types
may be used as set elements.
For a mutable equivalent, see the set class. |
| |
Methods defined here:
- __and__(self, other)
- Set intersection (& operator).
Returns a new set whose members are those which are in both
sets.
- __contains__(self, element)
- Set membership testing.
Returns True if the element is a member of the set.
- __eq__(self, other)
- Is this set equal to another set (has exactly the same member elements).
- __ge__(self, other)
- Test for superset relation. See issuperset() method.
- __getstate__(self)
- Pickler
- __gt__(self, other)
- Test for proper superset relation. See issuperset() method.
- __hash__(self)
- Returns a hash value for the set, useful for dictionary keys.
The hash value is dependent only upon the set members.
- __init__(self, elements=None)
- Create this set from the list of elements.
The elements can be any iterable object, or None to create an empty set.
- __iter__(self)
- Creates an iterator for the members of the set.
Note that the members are not produced in any predictable order.
- __le__(self, other)
- Is this set a subset of another set (or equal to it)?
- __len__(self)
- Returns the number of elements in this set.
- __lt__(self, other)
- Is this set a proper subset of another set (but no equal to it)?
- __ne__(self, other)
- Is this set not equal to another set (converse of __eq__ method).
- __nonzero__(self)
- Returns True if this set has any members, False if it is empty.
- __or__(self, other)
- Set union (| operator).
Returns a new set whose members are those which are in either
set.
- __repr__(self)
- Python-expression representation of this set
- __setstate__(self, state)
- Unpickler
- __str__(self)
- String human-readable representation of this set
- __sub__(self, other)
- Set difference (- operator).
Returns a new set whose members are in this set but not in the
other set.
- __unicode__(self)
- Unicode human-readable representation of this set
- __xor__(self, other)
- Set symmetric difference (^ operator).
Returns a new set whose members are those that are only in
one of the sets, but not both.
- copy(self)
- A shallow copy. Returns a new set with the same member elements.
- difference(self, other)
- Set difference.
Returns a new set whose members are in this set but not in the
other set. Unlike the (-)-operator, this method will also
accept any iterable sequence in place of a set object.
- intersection(self, other)
- Set intersection.
Returns a new set whose members are those which are in both
sets. Unlike the &-operator, this method will also accept any
iterable sequence in place of a set object.
- isempty(self)
- Returns True if this set is empty, False if it has any members.
- issubset(self, other)
- Test for subset relation.
- issuperset(self, other)
- Test for superset relation.
- symmetric_difference(self, other)
- Set symmetric difference.
Returns a new set whose members are those that are only in
one of the sets, but not both. Unlike the ^-operator, this
method will also accept any iterable sequence in place of a
set object.
- union(self, other)
- Set union.
Returns a new set whose members are those in either set.
Unlike the |-operator, this method will also accept any
iterable sequence in place of a set object.
Data and other attributes defined here:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'frozenset' objects>
- list of weak references to the object (if defined)
|
class set(frozenset) |
| |
A mutable set, an unordered collection of elements.
You can build one of these by passing in any sequence or iterable
as the argument to the constructor. Note that only hashable types
may be used as set elements.
For an immutable equivalent, see the frozenset class. |
| |
- Method resolution order:
- set
- frozenset
- __builtin__.object
Methods defined here:
- __delitem__(self, element)
- __hash__(self)
- add(self, element)
- Add the element to the set
- clear(self)
- Removes all members from the set, making it an empty set.
- difference_update(self, other)
- Removes any elements from this set which are in the other set.
- discard(self, element)
- Removes member from set if it is a member
- intersect_update(self, other)
- Removes any elements from this set that are not also in the other set.
- pop(self)
- Removes and returns one arbitrary member from the set
- remove(self, element)
- Removes member from set, or raises KeyError if not a member
- symmetric_difference_update(self, other)
- Modifies the set so that it contains all the elements that are in just one of the two sets.
- update(self, other)
- Adds all the elements of the other set into this one.
Methods inherited from frozenset:
- __and__(self, other)
- Set intersection (& operator).
Returns a new set whose members are those which are in both
sets.
- __contains__(self, element)
- Set membership testing.
Returns True if the element is a member of the set.
- __eq__(self, other)
- Is this set equal to another set (has exactly the same member elements).
- __ge__(self, other)
- Test for superset relation. See issuperset() method.
- __getstate__(self)
- Pickler
- __gt__(self, other)
- Test for proper superset relation. See issuperset() method.
- __init__(self, elements=None)
- Create this set from the list of elements.
The elements can be any iterable object, or None to create an empty set.
- __iter__(self)
- Creates an iterator for the members of the set.
Note that the members are not produced in any predictable order.
- __le__(self, other)
- Is this set a subset of another set (or equal to it)?
- __len__(self)
- Returns the number of elements in this set.
- __lt__(self, other)
- Is this set a proper subset of another set (but no equal to it)?
- __ne__(self, other)
- Is this set not equal to another set (converse of __eq__ method).
- __nonzero__(self)
- Returns True if this set has any members, False if it is empty.
- __or__(self, other)
- Set union (| operator).
Returns a new set whose members are those which are in either
set.
- __repr__(self)
- Python-expression representation of this set
- __setstate__(self, state)
- Unpickler
- __str__(self)
- String human-readable representation of this set
- __sub__(self, other)
- Set difference (- operator).
Returns a new set whose members are in this set but not in the
other set.
- __unicode__(self)
- Unicode human-readable representation of this set
- __xor__(self, other)
- Set symmetric difference (^ operator).
Returns a new set whose members are those that are only in
one of the sets, but not both.
- copy(self)
- A shallow copy. Returns a new set with the same member elements.
- difference(self, other)
- Set difference.
Returns a new set whose members are in this set but not in the
other set. Unlike the (-)-operator, this method will also
accept any iterable sequence in place of a set object.
- intersection(self, other)
- Set intersection.
Returns a new set whose members are those which are in both
sets. Unlike the &-operator, this method will also accept any
iterable sequence in place of a set object.
- isempty(self)
- Returns True if this set is empty, False if it has any members.
- issubset(self, other)
- Test for subset relation.
- issuperset(self, other)
- Test for superset relation.
- symmetric_difference(self, other)
- Set symmetric difference.
Returns a new set whose members are those that are only in
one of the sets, but not both. Unlike the ^-operator, this
method will also accept any iterable sequence in place of a
set object.
- union(self, other)
- Set union.
Returns a new set whose members are those in either set.
Unlike the |-operator, this method will also accept any
iterable sequence in place of a set object.
Data and other attributes inherited from frozenset:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'frozenset' objects>
- list of weak references to the object (if defined)
| |