415 lines
29 KiB
HTML
415 lines
29 KiB
HTML
|
|
<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<html><head><title>Python: module sets</title>
|
|
</head><body bgcolor="#f0f0f8">
|
|
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
|
|
<tr bgcolor="#7799ee">
|
|
<td valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>sets</strong></big></big></font></td
|
|
><td align=right valign=bottom
|
|
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/sets.py">/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/sets.py</a></font></td></tr></table>
|
|
<p><tt>Classes to represent arbitrary sets (including sets of sets).<br>
|
|
<br>
|
|
This module implements sets using dictionaries whose values are<br>
|
|
ignored. The usual operations (union, intersection, deletion, etc.)<br>
|
|
are provided as both methods and operators.<br>
|
|
<br>
|
|
Important: sets are not sequences! While they support 'x in s',<br>
|
|
'len(s)', and 'for x in s', none of those operations are unique for<br>
|
|
sequences; for example, mappings support all three as well. The<br>
|
|
characteristic operation for sequences is subscripting with small<br>
|
|
integers: s[i], for i in range(len(s)). Sets don't support<br>
|
|
subscripting at all. Also, sequences allow multiple occurrences and<br>
|
|
their elements have a definite order; sets on the other hand don't<br>
|
|
record multiple occurrences and don't remember the order of element<br>
|
|
insertion (which is why they don't support s[i]).<br>
|
|
<br>
|
|
The following classes are provided:<br>
|
|
<br>
|
|
<a href="#BaseSet">BaseSet</a> -- All the operations common to both mutable and immutable<br>
|
|
sets. This is an abstract class, not meant to be directly<br>
|
|
instantiated.<br>
|
|
<br>
|
|
<a href="#Set">Set</a> -- Mutable sets, subclass of <a href="#BaseSet">BaseSet</a>; not hashable.<br>
|
|
<br>
|
|
<a href="#ImmutableSet">ImmutableSet</a> -- Immutable sets, subclass of <a href="#BaseSet">BaseSet</a>; hashable.<br>
|
|
An iterable argument is mandatory to create an <a href="#ImmutableSet">ImmutableSet</a>.<br>
|
|
<br>
|
|
_TemporarilyImmutableSet -- A wrapper around a <a href="#Set">Set</a>, hashable,<br>
|
|
giving the same hash value as the immutable set equivalent<br>
|
|
would have. Do not use this class directly.<br>
|
|
<br>
|
|
Only hashable objects can be added to a <a href="#Set">Set</a>. In particular, you cannot<br>
|
|
really add a <a href="#Set">Set</a> as an element to another <a href="#Set">Set</a>; if you try, what is<br>
|
|
actually added is an <a href="#ImmutableSet">ImmutableSet</a> built from it (it compares equal to<br>
|
|
the one you tried adding).<br>
|
|
<br>
|
|
When you ask if `x in y' where x is a <a href="#Set">Set</a> and y is a <a href="#Set">Set</a> or<br>
|
|
<a href="#ImmutableSet">ImmutableSet</a>, x is wrapped into a _TemporarilyImmutableSet z, and<br>
|
|
what's tested is actually `z in y'.</tt></p>
|
|
<p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ee77aa">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
|
|
<td width="100%"><dl>
|
|
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
|
|
</font></dt><dd>
|
|
<dl>
|
|
<dt><font face="helvetica, arial"><a href="sets.html#BaseSet">BaseSet</a>
|
|
</font></dt><dd>
|
|
<dl>
|
|
<dt><font face="helvetica, arial"><a href="sets.html#ImmutableSet">ImmutableSet</a>
|
|
</font></dt><dt><font face="helvetica, arial"><a href="sets.html#Set">Set</a>
|
|
</font></dt></dl>
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
</dl>
|
|
<p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ffc8d8">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#000000" face="helvetica, arial"><a name="BaseSet">class <strong>BaseSet</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
|
|
|
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
|
<td colspan=2><tt>Common base class for mutable and immutable sets.<br> </tt></td></tr>
|
|
<tr><td> </td>
|
|
<td width="100%">Methods defined here:<br>
|
|
<dl><dt><a name="BaseSet-__and__"><strong>__and__</strong></a>(self, other)</dt><dd><tt>Return the intersection of two sets as a new set.<br>
|
|
<br>
|
|
(I.e. all elements that are in both sets.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="BaseSet-__cmp__"><strong>__cmp__</strong></a>(self, other)</dt></dl>
|
|
|
|
<dl><dt><a name="BaseSet-__contains__"><strong>__contains__</strong></a>(self, element)</dt><dd><tt>Report whether an element is a member of a set.<br>
|
|
<br>
|
|
(Called in response to the expression `element in self'.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="BaseSet-__copy__"><strong>__copy__</strong></a> = <a href="#BaseSet-copy">copy</a>(self)</dt></dl>
|
|
|
|
<dl><dt><a name="BaseSet-__deepcopy__"><strong>__deepcopy__</strong></a>(self, memo)</dt><dd><tt>Return a deep copy of a set; used by copy module.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="BaseSet-__eq__"><strong>__eq__</strong></a>(self, other)</dt></dl>
|
|
|
|
<dl><dt><a name="BaseSet-__ge__"><strong>__ge__</strong></a> = <a href="#BaseSet-issuperset">issuperset</a>(self, other)</dt></dl>
|
|
|
|
<dl><dt><a name="BaseSet-__gt__"><strong>__gt__</strong></a>(self, other)</dt></dl>
|
|
|
|
<dl><dt><a name="BaseSet-__init__"><strong>__init__</strong></a>(self)</dt><dd><tt>This is an abstract class.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="BaseSet-__iter__"><strong>__iter__</strong></a>(self)</dt><dd><tt>Return an iterator over the elements or a set.<br>
|
|
<br>
|
|
This is the keys iterator for the underlying dict.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="BaseSet-__le__"><strong>__le__</strong></a> = <a href="#BaseSet-issubset">issubset</a>(self, other)</dt></dl>
|
|
|
|
<dl><dt><a name="BaseSet-__len__"><strong>__len__</strong></a>(self)</dt><dd><tt>Return the number of elements of a set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="BaseSet-__lt__"><strong>__lt__</strong></a>(self, other)</dt></dl>
|
|
|
|
<dl><dt><a name="BaseSet-__ne__"><strong>__ne__</strong></a>(self, other)</dt></dl>
|
|
|
|
<dl><dt><a name="BaseSet-__or__"><strong>__or__</strong></a>(self, other)</dt><dd><tt>Return the union of two sets as a new set.<br>
|
|
<br>
|
|
(I.e. all elements that are in either set.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="BaseSet-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Return string representation of a set.<br>
|
|
<br>
|
|
This looks like '<a href="#Set">Set</a>([<list of elements>])'.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="BaseSet-__str__"><strong>__str__</strong></a> = <a href="#BaseSet-__repr__">__repr__</a>(self)</dt></dl>
|
|
|
|
<dl><dt><a name="BaseSet-__sub__"><strong>__sub__</strong></a>(self, other)</dt><dd><tt>Return the difference of two sets as a new <a href="#Set">Set</a>.<br>
|
|
<br>
|
|
(I.e. all elements that are in this set and not in the other.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="BaseSet-__xor__"><strong>__xor__</strong></a>(self, other)</dt><dd><tt>Return the symmetric difference of two sets as a new set.<br>
|
|
<br>
|
|
(I.e. all elements that are in exactly one of the sets.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="BaseSet-copy"><strong>copy</strong></a>(self)</dt><dd><tt>Return a shallow copy of a set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="BaseSet-difference"><strong>difference</strong></a>(self, other)</dt><dd><tt>Return the difference of two sets as a new <a href="#Set">Set</a>.<br>
|
|
<br>
|
|
(I.e. all elements that are in this set and not in the other.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="BaseSet-intersection"><strong>intersection</strong></a>(self, other)</dt><dd><tt>Return the intersection of two sets as a new set.<br>
|
|
<br>
|
|
(I.e. all elements that are in both sets.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="BaseSet-issubset"><strong>issubset</strong></a>(self, other)</dt><dd><tt>Report whether another set contains this set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="BaseSet-issuperset"><strong>issuperset</strong></a>(self, other)</dt><dd><tt>Report whether this set contains another set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="BaseSet-symmetric_difference"><strong>symmetric_difference</strong></a>(self, other)</dt><dd><tt>Return the symmetric difference of two sets as a new set.<br>
|
|
<br>
|
|
(I.e. all elements that are in exactly one of the sets.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="BaseSet-union"><strong>union</strong></a>(self, other)</dt><dd><tt>Return the union of two sets as a new set.<br>
|
|
<br>
|
|
(I.e. all elements that are in either set.)</tt></dd></dl>
|
|
|
|
<hr>
|
|
Data and other attributes defined here:<br>
|
|
<dl><dt><strong>__slots__</strong> = ['_data']</dl>
|
|
|
|
</td></tr></table> <p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ffc8d8">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#000000" face="helvetica, arial"><a name="ImmutableSet">class <strong>ImmutableSet</strong></a>(<a href="sets.html#BaseSet">BaseSet</a>)</font></td></tr>
|
|
|
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
|
<td colspan=2><tt>Immutable set class.<br> </tt></td></tr>
|
|
<tr><td> </td>
|
|
<td width="100%"><dl><dt>Method resolution order:</dt>
|
|
<dd><a href="sets.html#ImmutableSet">ImmutableSet</a></dd>
|
|
<dd><a href="sets.html#BaseSet">BaseSet</a></dd>
|
|
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
|
|
</dl>
|
|
<hr>
|
|
Methods defined here:<br>
|
|
<dl><dt><a name="ImmutableSet-__getstate__"><strong>__getstate__</strong></a>(self)</dt></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__hash__"><strong>__hash__</strong></a>(self)</dt></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__init__"><strong>__init__</strong></a>(self, iterable<font color="#909090">=None</font>)</dt><dd><tt>Construct an immutable set from an optional iterable.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__setstate__"><strong>__setstate__</strong></a>(self, state)</dt></dl>
|
|
|
|
<hr>
|
|
Data and other attributes defined here:<br>
|
|
<dl><dt><strong>__slots__</strong> = ['_hashcode']</dl>
|
|
|
|
<hr>
|
|
Methods inherited from <a href="sets.html#BaseSet">BaseSet</a>:<br>
|
|
<dl><dt><a name="ImmutableSet-__and__"><strong>__and__</strong></a>(self, other)</dt><dd><tt>Return the intersection of two sets as a new set.<br>
|
|
<br>
|
|
(I.e. all elements that are in both sets.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__cmp__"><strong>__cmp__</strong></a>(self, other)</dt></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__contains__"><strong>__contains__</strong></a>(self, element)</dt><dd><tt>Report whether an element is a member of a set.<br>
|
|
<br>
|
|
(Called in response to the expression `element in self'.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__copy__"><strong>__copy__</strong></a> = copy(self)</dt><dd><tt>Return a shallow copy of a set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__deepcopy__"><strong>__deepcopy__</strong></a>(self, memo)</dt><dd><tt>Return a deep copy of a set; used by copy module.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__eq__"><strong>__eq__</strong></a>(self, other)</dt></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__ge__"><strong>__ge__</strong></a> = issuperset(self, other)</dt><dd><tt>Report whether this set contains another set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__gt__"><strong>__gt__</strong></a>(self, other)</dt></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__iter__"><strong>__iter__</strong></a>(self)</dt><dd><tt>Return an iterator over the elements or a set.<br>
|
|
<br>
|
|
This is the keys iterator for the underlying dict.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__le__"><strong>__le__</strong></a> = issubset(self, other)</dt><dd><tt>Report whether another set contains this set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__len__"><strong>__len__</strong></a>(self)</dt><dd><tt>Return the number of elements of a set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__lt__"><strong>__lt__</strong></a>(self, other)</dt></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__ne__"><strong>__ne__</strong></a>(self, other)</dt></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__or__"><strong>__or__</strong></a>(self, other)</dt><dd><tt>Return the union of two sets as a new set.<br>
|
|
<br>
|
|
(I.e. all elements that are in either set.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Return string representation of a set.<br>
|
|
<br>
|
|
This looks like '<a href="#Set">Set</a>([<list of elements>])'.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__str__"><strong>__str__</strong></a> = __repr__(self)</dt><dd><tt>Return string representation of a set.<br>
|
|
<br>
|
|
This looks like '<a href="#Set">Set</a>([<list of elements>])'.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__sub__"><strong>__sub__</strong></a>(self, other)</dt><dd><tt>Return the difference of two sets as a new <a href="#Set">Set</a>.<br>
|
|
<br>
|
|
(I.e. all elements that are in this set and not in the other.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-__xor__"><strong>__xor__</strong></a>(self, other)</dt><dd><tt>Return the symmetric difference of two sets as a new set.<br>
|
|
<br>
|
|
(I.e. all elements that are in exactly one of the sets.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-copy"><strong>copy</strong></a>(self)</dt><dd><tt>Return a shallow copy of a set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-difference"><strong>difference</strong></a>(self, other)</dt><dd><tt>Return the difference of two sets as a new <a href="#Set">Set</a>.<br>
|
|
<br>
|
|
(I.e. all elements that are in this set and not in the other.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-intersection"><strong>intersection</strong></a>(self, other)</dt><dd><tt>Return the intersection of two sets as a new set.<br>
|
|
<br>
|
|
(I.e. all elements that are in both sets.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-issubset"><strong>issubset</strong></a>(self, other)</dt><dd><tt>Report whether another set contains this set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-issuperset"><strong>issuperset</strong></a>(self, other)</dt><dd><tt>Report whether this set contains another set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-symmetric_difference"><strong>symmetric_difference</strong></a>(self, other)</dt><dd><tt>Return the symmetric difference of two sets as a new set.<br>
|
|
<br>
|
|
(I.e. all elements that are in exactly one of the sets.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ImmutableSet-union"><strong>union</strong></a>(self, other)</dt><dd><tt>Return the union of two sets as a new set.<br>
|
|
<br>
|
|
(I.e. all elements that are in either set.)</tt></dd></dl>
|
|
|
|
</td></tr></table> <p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ffc8d8">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#000000" face="helvetica, arial"><a name="Set">class <strong>Set</strong></a>(<a href="sets.html#BaseSet">BaseSet</a>)</font></td></tr>
|
|
|
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
|
<td colspan=2><tt>Mutable set class.<br> </tt></td></tr>
|
|
<tr><td> </td>
|
|
<td width="100%"><dl><dt>Method resolution order:</dt>
|
|
<dd><a href="sets.html#Set">Set</a></dd>
|
|
<dd><a href="sets.html#BaseSet">BaseSet</a></dd>
|
|
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
|
|
</dl>
|
|
<hr>
|
|
Methods defined here:<br>
|
|
<dl><dt><a name="Set-__as_immutable__"><strong>__as_immutable__</strong></a>(self)</dt></dl>
|
|
|
|
<dl><dt><a name="Set-__as_temporarily_immutable__"><strong>__as_temporarily_immutable__</strong></a>(self)</dt></dl>
|
|
|
|
<dl><dt><a name="Set-__getstate__"><strong>__getstate__</strong></a>(self)</dt></dl>
|
|
|
|
<dl><dt><a name="Set-__hash__"><strong>__hash__</strong></a>(self)</dt><dd><tt>A <a href="#Set">Set</a> cannot be hashed.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-__iand__"><strong>__iand__</strong></a>(self, other)</dt><dd><tt>Update a set with the intersection of itself and another.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-__init__"><strong>__init__</strong></a>(self, iterable<font color="#909090">=None</font>)</dt><dd><tt>Construct a set from an optional iterable.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-__ior__"><strong>__ior__</strong></a>(self, other)</dt><dd><tt>Update a set with the union of itself and another.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-__isub__"><strong>__isub__</strong></a>(self, other)</dt><dd><tt>Remove all elements of another set from this set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-__ixor__"><strong>__ixor__</strong></a>(self, other)</dt><dd><tt>Update a set with the symmetric difference of itself and another.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-__setstate__"><strong>__setstate__</strong></a>(self, data)</dt></dl>
|
|
|
|
<dl><dt><a name="Set-add"><strong>add</strong></a>(self, element)</dt><dd><tt>Add an element to a set.<br>
|
|
<br>
|
|
This has no effect if the element is already present.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-clear"><strong>clear</strong></a>(self)</dt><dd><tt>Remove all elements from this set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-difference_update"><strong>difference_update</strong></a>(self, other)</dt><dd><tt>Remove all elements of another set from this set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-discard"><strong>discard</strong></a>(self, element)</dt><dd><tt>Remove an element from a set if it is a member.<br>
|
|
<br>
|
|
If the element is not a member, do nothing.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-intersection_update"><strong>intersection_update</strong></a>(self, other)</dt><dd><tt>Update a set with the intersection of itself and another.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-pop"><strong>pop</strong></a>(self)</dt><dd><tt>Remove and return an arbitrary set element.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-remove"><strong>remove</strong></a>(self, element)</dt><dd><tt>Remove an element from a set; it must be a member.<br>
|
|
<br>
|
|
If the element is not a member, raise a KeyError.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-symmetric_difference_update"><strong>symmetric_difference_update</strong></a>(self, other)</dt><dd><tt>Update a set with the symmetric difference of itself and another.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-union_update"><strong>union_update</strong></a>(self, other)</dt><dd><tt>Update a set with the union of itself and another.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-update"><strong>update</strong></a>(self, iterable)</dt><dd><tt>Add all values from an iterable (such as a list or file).</tt></dd></dl>
|
|
|
|
<hr>
|
|
Data and other attributes defined here:<br>
|
|
<dl><dt><strong>__slots__</strong> = []</dl>
|
|
|
|
<hr>
|
|
Methods inherited from <a href="sets.html#BaseSet">BaseSet</a>:<br>
|
|
<dl><dt><a name="Set-__and__"><strong>__and__</strong></a>(self, other)</dt><dd><tt>Return the intersection of two sets as a new set.<br>
|
|
<br>
|
|
(I.e. all elements that are in both sets.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-__cmp__"><strong>__cmp__</strong></a>(self, other)</dt></dl>
|
|
|
|
<dl><dt><a name="Set-__contains__"><strong>__contains__</strong></a>(self, element)</dt><dd><tt>Report whether an element is a member of a set.<br>
|
|
<br>
|
|
(Called in response to the expression `element in self'.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-__copy__"><strong>__copy__</strong></a> = copy(self)</dt><dd><tt>Return a shallow copy of a set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-__deepcopy__"><strong>__deepcopy__</strong></a>(self, memo)</dt><dd><tt>Return a deep copy of a set; used by copy module.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-__eq__"><strong>__eq__</strong></a>(self, other)</dt></dl>
|
|
|
|
<dl><dt><a name="Set-__ge__"><strong>__ge__</strong></a> = issuperset(self, other)</dt><dd><tt>Report whether this set contains another set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-__gt__"><strong>__gt__</strong></a>(self, other)</dt></dl>
|
|
|
|
<dl><dt><a name="Set-__iter__"><strong>__iter__</strong></a>(self)</dt><dd><tt>Return an iterator over the elements or a set.<br>
|
|
<br>
|
|
This is the keys iterator for the underlying dict.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-__le__"><strong>__le__</strong></a> = issubset(self, other)</dt><dd><tt>Report whether another set contains this set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-__len__"><strong>__len__</strong></a>(self)</dt><dd><tt>Return the number of elements of a set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-__lt__"><strong>__lt__</strong></a>(self, other)</dt></dl>
|
|
|
|
<dl><dt><a name="Set-__ne__"><strong>__ne__</strong></a>(self, other)</dt></dl>
|
|
|
|
<dl><dt><a name="Set-__or__"><strong>__or__</strong></a>(self, other)</dt><dd><tt>Return the union of two sets as a new set.<br>
|
|
<br>
|
|
(I.e. all elements that are in either set.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Return string representation of a set.<br>
|
|
<br>
|
|
This looks like '<a href="#Set">Set</a>([<list of elements>])'.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-__str__"><strong>__str__</strong></a> = __repr__(self)</dt><dd><tt>Return string representation of a set.<br>
|
|
<br>
|
|
This looks like '<a href="#Set">Set</a>([<list of elements>])'.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-__sub__"><strong>__sub__</strong></a>(self, other)</dt><dd><tt>Return the difference of two sets as a new <a href="#Set">Set</a>.<br>
|
|
<br>
|
|
(I.e. all elements that are in this set and not in the other.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-__xor__"><strong>__xor__</strong></a>(self, other)</dt><dd><tt>Return the symmetric difference of two sets as a new set.<br>
|
|
<br>
|
|
(I.e. all elements that are in exactly one of the sets.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-copy"><strong>copy</strong></a>(self)</dt><dd><tt>Return a shallow copy of a set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-difference"><strong>difference</strong></a>(self, other)</dt><dd><tt>Return the difference of two sets as a new <a href="#Set">Set</a>.<br>
|
|
<br>
|
|
(I.e. all elements that are in this set and not in the other.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-intersection"><strong>intersection</strong></a>(self, other)</dt><dd><tt>Return the intersection of two sets as a new set.<br>
|
|
<br>
|
|
(I.e. all elements that are in both sets.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-issubset"><strong>issubset</strong></a>(self, other)</dt><dd><tt>Report whether another set contains this set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-issuperset"><strong>issuperset</strong></a>(self, other)</dt><dd><tt>Report whether this set contains another set.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-symmetric_difference"><strong>symmetric_difference</strong></a>(self, other)</dt><dd><tt>Return the symmetric difference of two sets as a new set.<br>
|
|
<br>
|
|
(I.e. all elements that are in exactly one of the sets.)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Set-union"><strong>union</strong></a>(self, other)</dt><dd><tt>Return the union of two sets as a new set.<br>
|
|
<br>
|
|
(I.e. all elements that are in either set.)</tt></dd></dl>
|
|
|
|
</td></tr></table></td></tr></table><p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#55aa55">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
|
|
<td width="100%"><strong>__all__</strong> = ['BaseSet', 'Set', 'ImmutableSet']<br>
|
|
<strong>generators</strong> = _Feature((2, 2, 0, 'alpha', 1), (2, 3, 0, 'final', 0), 4096)</td></tr></table>
|
|
</body></html> |