Erik van Blokland 3646055ea2 initial import
git-svn-id: http://svn.robofab.com/trunk@1 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2008-01-07 17:40:34 +00:00

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>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<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&nbsp;to&nbsp;represent&nbsp;arbitrary&nbsp;sets&nbsp;(including&nbsp;sets&nbsp;of&nbsp;sets).<br>
&nbsp;<br>
This&nbsp;module&nbsp;implements&nbsp;sets&nbsp;using&nbsp;dictionaries&nbsp;whose&nbsp;values&nbsp;are<br>
ignored.&nbsp;&nbsp;The&nbsp;usual&nbsp;operations&nbsp;(union,&nbsp;intersection,&nbsp;deletion,&nbsp;etc.)<br>
are&nbsp;provided&nbsp;as&nbsp;both&nbsp;methods&nbsp;and&nbsp;operators.<br>
&nbsp;<br>
Important:&nbsp;sets&nbsp;are&nbsp;not&nbsp;sequences!&nbsp;&nbsp;While&nbsp;they&nbsp;support&nbsp;'x&nbsp;in&nbsp;s',<br>
'len(s)',&nbsp;and&nbsp;'for&nbsp;x&nbsp;in&nbsp;s',&nbsp;none&nbsp;of&nbsp;those&nbsp;operations&nbsp;are&nbsp;unique&nbsp;for<br>
sequences;&nbsp;for&nbsp;example,&nbsp;mappings&nbsp;support&nbsp;all&nbsp;three&nbsp;as&nbsp;well.&nbsp;&nbsp;The<br>
characteristic&nbsp;operation&nbsp;for&nbsp;sequences&nbsp;is&nbsp;subscripting&nbsp;with&nbsp;small<br>
integers:&nbsp;s[i],&nbsp;for&nbsp;i&nbsp;in&nbsp;range(len(s)).&nbsp;&nbsp;Sets&nbsp;don't&nbsp;support<br>
subscripting&nbsp;at&nbsp;all.&nbsp;&nbsp;Also,&nbsp;sequences&nbsp;allow&nbsp;multiple&nbsp;occurrences&nbsp;and<br>
their&nbsp;elements&nbsp;have&nbsp;a&nbsp;definite&nbsp;order;&nbsp;sets&nbsp;on&nbsp;the&nbsp;other&nbsp;hand&nbsp;don't<br>
record&nbsp;multiple&nbsp;occurrences&nbsp;and&nbsp;don't&nbsp;remember&nbsp;the&nbsp;order&nbsp;of&nbsp;element<br>
insertion&nbsp;(which&nbsp;is&nbsp;why&nbsp;they&nbsp;don't&nbsp;support&nbsp;s[i]).<br>
&nbsp;<br>
The&nbsp;following&nbsp;classes&nbsp;are&nbsp;provided:<br>
&nbsp;<br>
<a href="#BaseSet">BaseSet</a>&nbsp;--&nbsp;All&nbsp;the&nbsp;operations&nbsp;common&nbsp;to&nbsp;both&nbsp;mutable&nbsp;and&nbsp;immutable<br>
&nbsp;&nbsp;&nbsp;&nbsp;sets.&nbsp;This&nbsp;is&nbsp;an&nbsp;abstract&nbsp;class,&nbsp;not&nbsp;meant&nbsp;to&nbsp;be&nbsp;directly<br>
&nbsp;&nbsp;&nbsp;&nbsp;instantiated.<br>
&nbsp;<br>
<a href="#Set">Set</a>&nbsp;--&nbsp;Mutable&nbsp;sets,&nbsp;subclass&nbsp;of&nbsp;<a href="#BaseSet">BaseSet</a>;&nbsp;not&nbsp;hashable.<br>
&nbsp;<br>
<a href="#ImmutableSet">ImmutableSet</a>&nbsp;--&nbsp;Immutable&nbsp;sets,&nbsp;subclass&nbsp;of&nbsp;<a href="#BaseSet">BaseSet</a>;&nbsp;hashable.<br>
&nbsp;&nbsp;&nbsp;&nbsp;An&nbsp;iterable&nbsp;argument&nbsp;is&nbsp;mandatory&nbsp;to&nbsp;create&nbsp;an&nbsp;<a href="#ImmutableSet">ImmutableSet</a>.<br>
&nbsp;<br>
_TemporarilyImmutableSet&nbsp;--&nbsp;A&nbsp;wrapper&nbsp;around&nbsp;a&nbsp;<a href="#Set">Set</a>,&nbsp;hashable,<br>
&nbsp;&nbsp;&nbsp;&nbsp;giving&nbsp;the&nbsp;same&nbsp;hash&nbsp;value&nbsp;as&nbsp;the&nbsp;immutable&nbsp;set&nbsp;equivalent<br>
&nbsp;&nbsp;&nbsp;&nbsp;would&nbsp;have.&nbsp;&nbsp;Do&nbsp;not&nbsp;use&nbsp;this&nbsp;class&nbsp;directly.<br>
&nbsp;<br>
Only&nbsp;hashable&nbsp;objects&nbsp;can&nbsp;be&nbsp;added&nbsp;to&nbsp;a&nbsp;<a href="#Set">Set</a>.&nbsp;In&nbsp;particular,&nbsp;you&nbsp;cannot<br>
really&nbsp;add&nbsp;a&nbsp;<a href="#Set">Set</a>&nbsp;as&nbsp;an&nbsp;element&nbsp;to&nbsp;another&nbsp;<a href="#Set">Set</a>;&nbsp;if&nbsp;you&nbsp;try,&nbsp;what&nbsp;is<br>
actually&nbsp;added&nbsp;is&nbsp;an&nbsp;<a href="#ImmutableSet">ImmutableSet</a>&nbsp;built&nbsp;from&nbsp;it&nbsp;(it&nbsp;compares&nbsp;equal&nbsp;to<br>
the&nbsp;one&nbsp;you&nbsp;tried&nbsp;adding).<br>
&nbsp;<br>
When&nbsp;you&nbsp;ask&nbsp;if&nbsp;`x&nbsp;in&nbsp;y'&nbsp;where&nbsp;x&nbsp;is&nbsp;a&nbsp;<a href="#Set">Set</a>&nbsp;and&nbsp;y&nbsp;is&nbsp;a&nbsp;<a href="#Set">Set</a>&nbsp;or<br>
<a href="#ImmutableSet">ImmutableSet</a>,&nbsp;x&nbsp;is&nbsp;wrapped&nbsp;into&nbsp;a&nbsp;_TemporarilyImmutableSet&nbsp;z,&nbsp;and<br>
what's&nbsp;tested&nbsp;is&nbsp;actually&nbsp;`z&nbsp;in&nbsp;y'.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</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>&nbsp;<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>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Common&nbsp;base&nbsp;class&nbsp;for&nbsp;mutable&nbsp;and&nbsp;immutable&nbsp;sets.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="BaseSet-__and__"><strong>__and__</strong></a>(self, other)</dt><dd><tt>Return&nbsp;the&nbsp;intersection&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;set.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;both&nbsp;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&nbsp;whether&nbsp;an&nbsp;element&nbsp;is&nbsp;a&nbsp;member&nbsp;of&nbsp;a&nbsp;set.<br>
&nbsp;<br>
(Called&nbsp;in&nbsp;response&nbsp;to&nbsp;the&nbsp;expression&nbsp;`element&nbsp;in&nbsp;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&nbsp;a&nbsp;deep&nbsp;copy&nbsp;of&nbsp;a&nbsp;set;&nbsp;used&nbsp;by&nbsp;copy&nbsp;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&nbsp;is&nbsp;an&nbsp;abstract&nbsp;class.</tt></dd></dl>
<dl><dt><a name="BaseSet-__iter__"><strong>__iter__</strong></a>(self)</dt><dd><tt>Return&nbsp;an&nbsp;iterator&nbsp;over&nbsp;the&nbsp;elements&nbsp;or&nbsp;a&nbsp;set.<br>
&nbsp;<br>
This&nbsp;is&nbsp;the&nbsp;keys&nbsp;iterator&nbsp;for&nbsp;the&nbsp;underlying&nbsp;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&nbsp;the&nbsp;number&nbsp;of&nbsp;elements&nbsp;of&nbsp;a&nbsp;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&nbsp;the&nbsp;union&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;set.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;either&nbsp;set.)</tt></dd></dl>
<dl><dt><a name="BaseSet-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Return&nbsp;string&nbsp;representation&nbsp;of&nbsp;a&nbsp;set.<br>
&nbsp;<br>
This&nbsp;looks&nbsp;like&nbsp;'<a href="#Set">Set</a>([&lt;list&nbsp;of&nbsp;elements&gt;])'.</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&nbsp;the&nbsp;difference&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;<a href="#Set">Set</a>.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;this&nbsp;set&nbsp;and&nbsp;not&nbsp;in&nbsp;the&nbsp;other.)</tt></dd></dl>
<dl><dt><a name="BaseSet-__xor__"><strong>__xor__</strong></a>(self, other)</dt><dd><tt>Return&nbsp;the&nbsp;symmetric&nbsp;difference&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;set.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;exactly&nbsp;one&nbsp;of&nbsp;the&nbsp;sets.)</tt></dd></dl>
<dl><dt><a name="BaseSet-copy"><strong>copy</strong></a>(self)</dt><dd><tt>Return&nbsp;a&nbsp;shallow&nbsp;copy&nbsp;of&nbsp;a&nbsp;set.</tt></dd></dl>
<dl><dt><a name="BaseSet-difference"><strong>difference</strong></a>(self, other)</dt><dd><tt>Return&nbsp;the&nbsp;difference&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;<a href="#Set">Set</a>.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;this&nbsp;set&nbsp;and&nbsp;not&nbsp;in&nbsp;the&nbsp;other.)</tt></dd></dl>
<dl><dt><a name="BaseSet-intersection"><strong>intersection</strong></a>(self, other)</dt><dd><tt>Return&nbsp;the&nbsp;intersection&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;set.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;both&nbsp;sets.)</tt></dd></dl>
<dl><dt><a name="BaseSet-issubset"><strong>issubset</strong></a>(self, other)</dt><dd><tt>Report&nbsp;whether&nbsp;another&nbsp;set&nbsp;contains&nbsp;this&nbsp;set.</tt></dd></dl>
<dl><dt><a name="BaseSet-issuperset"><strong>issuperset</strong></a>(self, other)</dt><dd><tt>Report&nbsp;whether&nbsp;this&nbsp;set&nbsp;contains&nbsp;another&nbsp;set.</tt></dd></dl>
<dl><dt><a name="BaseSet-symmetric_difference"><strong>symmetric_difference</strong></a>(self, other)</dt><dd><tt>Return&nbsp;the&nbsp;symmetric&nbsp;difference&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;set.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;exactly&nbsp;one&nbsp;of&nbsp;the&nbsp;sets.)</tt></dd></dl>
<dl><dt><a name="BaseSet-union"><strong>union</strong></a>(self, other)</dt><dd><tt>Return&nbsp;the&nbsp;union&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;set.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;either&nbsp;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>&nbsp;<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>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Immutable&nbsp;set&nbsp;class.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</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&nbsp;an&nbsp;immutable&nbsp;set&nbsp;from&nbsp;an&nbsp;optional&nbsp;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&nbsp;the&nbsp;intersection&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;set.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;both&nbsp;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&nbsp;whether&nbsp;an&nbsp;element&nbsp;is&nbsp;a&nbsp;member&nbsp;of&nbsp;a&nbsp;set.<br>
&nbsp;<br>
(Called&nbsp;in&nbsp;response&nbsp;to&nbsp;the&nbsp;expression&nbsp;`element&nbsp;in&nbsp;self'.)</tt></dd></dl>
<dl><dt><a name="ImmutableSet-__copy__"><strong>__copy__</strong></a> = copy(self)</dt><dd><tt>Return&nbsp;a&nbsp;shallow&nbsp;copy&nbsp;of&nbsp;a&nbsp;set.</tt></dd></dl>
<dl><dt><a name="ImmutableSet-__deepcopy__"><strong>__deepcopy__</strong></a>(self, memo)</dt><dd><tt>Return&nbsp;a&nbsp;deep&nbsp;copy&nbsp;of&nbsp;a&nbsp;set;&nbsp;used&nbsp;by&nbsp;copy&nbsp;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&nbsp;whether&nbsp;this&nbsp;set&nbsp;contains&nbsp;another&nbsp;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&nbsp;an&nbsp;iterator&nbsp;over&nbsp;the&nbsp;elements&nbsp;or&nbsp;a&nbsp;set.<br>
&nbsp;<br>
This&nbsp;is&nbsp;the&nbsp;keys&nbsp;iterator&nbsp;for&nbsp;the&nbsp;underlying&nbsp;dict.</tt></dd></dl>
<dl><dt><a name="ImmutableSet-__le__"><strong>__le__</strong></a> = issubset(self, other)</dt><dd><tt>Report&nbsp;whether&nbsp;another&nbsp;set&nbsp;contains&nbsp;this&nbsp;set.</tt></dd></dl>
<dl><dt><a name="ImmutableSet-__len__"><strong>__len__</strong></a>(self)</dt><dd><tt>Return&nbsp;the&nbsp;number&nbsp;of&nbsp;elements&nbsp;of&nbsp;a&nbsp;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&nbsp;the&nbsp;union&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;set.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;either&nbsp;set.)</tt></dd></dl>
<dl><dt><a name="ImmutableSet-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Return&nbsp;string&nbsp;representation&nbsp;of&nbsp;a&nbsp;set.<br>
&nbsp;<br>
This&nbsp;looks&nbsp;like&nbsp;'<a href="#Set">Set</a>([&lt;list&nbsp;of&nbsp;elements&gt;])'.</tt></dd></dl>
<dl><dt><a name="ImmutableSet-__str__"><strong>__str__</strong></a> = __repr__(self)</dt><dd><tt>Return&nbsp;string&nbsp;representation&nbsp;of&nbsp;a&nbsp;set.<br>
&nbsp;<br>
This&nbsp;looks&nbsp;like&nbsp;'<a href="#Set">Set</a>([&lt;list&nbsp;of&nbsp;elements&gt;])'.</tt></dd></dl>
<dl><dt><a name="ImmutableSet-__sub__"><strong>__sub__</strong></a>(self, other)</dt><dd><tt>Return&nbsp;the&nbsp;difference&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;<a href="#Set">Set</a>.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;this&nbsp;set&nbsp;and&nbsp;not&nbsp;in&nbsp;the&nbsp;other.)</tt></dd></dl>
<dl><dt><a name="ImmutableSet-__xor__"><strong>__xor__</strong></a>(self, other)</dt><dd><tt>Return&nbsp;the&nbsp;symmetric&nbsp;difference&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;set.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;exactly&nbsp;one&nbsp;of&nbsp;the&nbsp;sets.)</tt></dd></dl>
<dl><dt><a name="ImmutableSet-copy"><strong>copy</strong></a>(self)</dt><dd><tt>Return&nbsp;a&nbsp;shallow&nbsp;copy&nbsp;of&nbsp;a&nbsp;set.</tt></dd></dl>
<dl><dt><a name="ImmutableSet-difference"><strong>difference</strong></a>(self, other)</dt><dd><tt>Return&nbsp;the&nbsp;difference&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;<a href="#Set">Set</a>.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;this&nbsp;set&nbsp;and&nbsp;not&nbsp;in&nbsp;the&nbsp;other.)</tt></dd></dl>
<dl><dt><a name="ImmutableSet-intersection"><strong>intersection</strong></a>(self, other)</dt><dd><tt>Return&nbsp;the&nbsp;intersection&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;set.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;both&nbsp;sets.)</tt></dd></dl>
<dl><dt><a name="ImmutableSet-issubset"><strong>issubset</strong></a>(self, other)</dt><dd><tt>Report&nbsp;whether&nbsp;another&nbsp;set&nbsp;contains&nbsp;this&nbsp;set.</tt></dd></dl>
<dl><dt><a name="ImmutableSet-issuperset"><strong>issuperset</strong></a>(self, other)</dt><dd><tt>Report&nbsp;whether&nbsp;this&nbsp;set&nbsp;contains&nbsp;another&nbsp;set.</tt></dd></dl>
<dl><dt><a name="ImmutableSet-symmetric_difference"><strong>symmetric_difference</strong></a>(self, other)</dt><dd><tt>Return&nbsp;the&nbsp;symmetric&nbsp;difference&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;set.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;exactly&nbsp;one&nbsp;of&nbsp;the&nbsp;sets.)</tt></dd></dl>
<dl><dt><a name="ImmutableSet-union"><strong>union</strong></a>(self, other)</dt><dd><tt>Return&nbsp;the&nbsp;union&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;set.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;either&nbsp;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>&nbsp;<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>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Mutable&nbsp;set&nbsp;class.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</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&nbsp;<a href="#Set">Set</a>&nbsp;cannot&nbsp;be&nbsp;hashed.</tt></dd></dl>
<dl><dt><a name="Set-__iand__"><strong>__iand__</strong></a>(self, other)</dt><dd><tt>Update&nbsp;a&nbsp;set&nbsp;with&nbsp;the&nbsp;intersection&nbsp;of&nbsp;itself&nbsp;and&nbsp;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&nbsp;a&nbsp;set&nbsp;from&nbsp;an&nbsp;optional&nbsp;iterable.</tt></dd></dl>
<dl><dt><a name="Set-__ior__"><strong>__ior__</strong></a>(self, other)</dt><dd><tt>Update&nbsp;a&nbsp;set&nbsp;with&nbsp;the&nbsp;union&nbsp;of&nbsp;itself&nbsp;and&nbsp;another.</tt></dd></dl>
<dl><dt><a name="Set-__isub__"><strong>__isub__</strong></a>(self, other)</dt><dd><tt>Remove&nbsp;all&nbsp;elements&nbsp;of&nbsp;another&nbsp;set&nbsp;from&nbsp;this&nbsp;set.</tt></dd></dl>
<dl><dt><a name="Set-__ixor__"><strong>__ixor__</strong></a>(self, other)</dt><dd><tt>Update&nbsp;a&nbsp;set&nbsp;with&nbsp;the&nbsp;symmetric&nbsp;difference&nbsp;of&nbsp;itself&nbsp;and&nbsp;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&nbsp;an&nbsp;element&nbsp;to&nbsp;a&nbsp;set.<br>
&nbsp;<br>
This&nbsp;has&nbsp;no&nbsp;effect&nbsp;if&nbsp;the&nbsp;element&nbsp;is&nbsp;already&nbsp;present.</tt></dd></dl>
<dl><dt><a name="Set-clear"><strong>clear</strong></a>(self)</dt><dd><tt>Remove&nbsp;all&nbsp;elements&nbsp;from&nbsp;this&nbsp;set.</tt></dd></dl>
<dl><dt><a name="Set-difference_update"><strong>difference_update</strong></a>(self, other)</dt><dd><tt>Remove&nbsp;all&nbsp;elements&nbsp;of&nbsp;another&nbsp;set&nbsp;from&nbsp;this&nbsp;set.</tt></dd></dl>
<dl><dt><a name="Set-discard"><strong>discard</strong></a>(self, element)</dt><dd><tt>Remove&nbsp;an&nbsp;element&nbsp;from&nbsp;a&nbsp;set&nbsp;if&nbsp;it&nbsp;is&nbsp;a&nbsp;member.<br>
&nbsp;<br>
If&nbsp;the&nbsp;element&nbsp;is&nbsp;not&nbsp;a&nbsp;member,&nbsp;do&nbsp;nothing.</tt></dd></dl>
<dl><dt><a name="Set-intersection_update"><strong>intersection_update</strong></a>(self, other)</dt><dd><tt>Update&nbsp;a&nbsp;set&nbsp;with&nbsp;the&nbsp;intersection&nbsp;of&nbsp;itself&nbsp;and&nbsp;another.</tt></dd></dl>
<dl><dt><a name="Set-pop"><strong>pop</strong></a>(self)</dt><dd><tt>Remove&nbsp;and&nbsp;return&nbsp;an&nbsp;arbitrary&nbsp;set&nbsp;element.</tt></dd></dl>
<dl><dt><a name="Set-remove"><strong>remove</strong></a>(self, element)</dt><dd><tt>Remove&nbsp;an&nbsp;element&nbsp;from&nbsp;a&nbsp;set;&nbsp;it&nbsp;must&nbsp;be&nbsp;a&nbsp;member.<br>
&nbsp;<br>
If&nbsp;the&nbsp;element&nbsp;is&nbsp;not&nbsp;a&nbsp;member,&nbsp;raise&nbsp;a&nbsp;KeyError.</tt></dd></dl>
<dl><dt><a name="Set-symmetric_difference_update"><strong>symmetric_difference_update</strong></a>(self, other)</dt><dd><tt>Update&nbsp;a&nbsp;set&nbsp;with&nbsp;the&nbsp;symmetric&nbsp;difference&nbsp;of&nbsp;itself&nbsp;and&nbsp;another.</tt></dd></dl>
<dl><dt><a name="Set-union_update"><strong>union_update</strong></a>(self, other)</dt><dd><tt>Update&nbsp;a&nbsp;set&nbsp;with&nbsp;the&nbsp;union&nbsp;of&nbsp;itself&nbsp;and&nbsp;another.</tt></dd></dl>
<dl><dt><a name="Set-update"><strong>update</strong></a>(self, iterable)</dt><dd><tt>Add&nbsp;all&nbsp;values&nbsp;from&nbsp;an&nbsp;iterable&nbsp;(such&nbsp;as&nbsp;a&nbsp;list&nbsp;or&nbsp;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&nbsp;the&nbsp;intersection&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;set.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;both&nbsp;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&nbsp;whether&nbsp;an&nbsp;element&nbsp;is&nbsp;a&nbsp;member&nbsp;of&nbsp;a&nbsp;set.<br>
&nbsp;<br>
(Called&nbsp;in&nbsp;response&nbsp;to&nbsp;the&nbsp;expression&nbsp;`element&nbsp;in&nbsp;self'.)</tt></dd></dl>
<dl><dt><a name="Set-__copy__"><strong>__copy__</strong></a> = copy(self)</dt><dd><tt>Return&nbsp;a&nbsp;shallow&nbsp;copy&nbsp;of&nbsp;a&nbsp;set.</tt></dd></dl>
<dl><dt><a name="Set-__deepcopy__"><strong>__deepcopy__</strong></a>(self, memo)</dt><dd><tt>Return&nbsp;a&nbsp;deep&nbsp;copy&nbsp;of&nbsp;a&nbsp;set;&nbsp;used&nbsp;by&nbsp;copy&nbsp;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&nbsp;whether&nbsp;this&nbsp;set&nbsp;contains&nbsp;another&nbsp;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&nbsp;an&nbsp;iterator&nbsp;over&nbsp;the&nbsp;elements&nbsp;or&nbsp;a&nbsp;set.<br>
&nbsp;<br>
This&nbsp;is&nbsp;the&nbsp;keys&nbsp;iterator&nbsp;for&nbsp;the&nbsp;underlying&nbsp;dict.</tt></dd></dl>
<dl><dt><a name="Set-__le__"><strong>__le__</strong></a> = issubset(self, other)</dt><dd><tt>Report&nbsp;whether&nbsp;another&nbsp;set&nbsp;contains&nbsp;this&nbsp;set.</tt></dd></dl>
<dl><dt><a name="Set-__len__"><strong>__len__</strong></a>(self)</dt><dd><tt>Return&nbsp;the&nbsp;number&nbsp;of&nbsp;elements&nbsp;of&nbsp;a&nbsp;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&nbsp;the&nbsp;union&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;set.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;either&nbsp;set.)</tt></dd></dl>
<dl><dt><a name="Set-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Return&nbsp;string&nbsp;representation&nbsp;of&nbsp;a&nbsp;set.<br>
&nbsp;<br>
This&nbsp;looks&nbsp;like&nbsp;'<a href="#Set">Set</a>([&lt;list&nbsp;of&nbsp;elements&gt;])'.</tt></dd></dl>
<dl><dt><a name="Set-__str__"><strong>__str__</strong></a> = __repr__(self)</dt><dd><tt>Return&nbsp;string&nbsp;representation&nbsp;of&nbsp;a&nbsp;set.<br>
&nbsp;<br>
This&nbsp;looks&nbsp;like&nbsp;'<a href="#Set">Set</a>([&lt;list&nbsp;of&nbsp;elements&gt;])'.</tt></dd></dl>
<dl><dt><a name="Set-__sub__"><strong>__sub__</strong></a>(self, other)</dt><dd><tt>Return&nbsp;the&nbsp;difference&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;<a href="#Set">Set</a>.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;this&nbsp;set&nbsp;and&nbsp;not&nbsp;in&nbsp;the&nbsp;other.)</tt></dd></dl>
<dl><dt><a name="Set-__xor__"><strong>__xor__</strong></a>(self, other)</dt><dd><tt>Return&nbsp;the&nbsp;symmetric&nbsp;difference&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;set.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;exactly&nbsp;one&nbsp;of&nbsp;the&nbsp;sets.)</tt></dd></dl>
<dl><dt><a name="Set-copy"><strong>copy</strong></a>(self)</dt><dd><tt>Return&nbsp;a&nbsp;shallow&nbsp;copy&nbsp;of&nbsp;a&nbsp;set.</tt></dd></dl>
<dl><dt><a name="Set-difference"><strong>difference</strong></a>(self, other)</dt><dd><tt>Return&nbsp;the&nbsp;difference&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;<a href="#Set">Set</a>.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;this&nbsp;set&nbsp;and&nbsp;not&nbsp;in&nbsp;the&nbsp;other.)</tt></dd></dl>
<dl><dt><a name="Set-intersection"><strong>intersection</strong></a>(self, other)</dt><dd><tt>Return&nbsp;the&nbsp;intersection&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;set.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;both&nbsp;sets.)</tt></dd></dl>
<dl><dt><a name="Set-issubset"><strong>issubset</strong></a>(self, other)</dt><dd><tt>Report&nbsp;whether&nbsp;another&nbsp;set&nbsp;contains&nbsp;this&nbsp;set.</tt></dd></dl>
<dl><dt><a name="Set-issuperset"><strong>issuperset</strong></a>(self, other)</dt><dd><tt>Report&nbsp;whether&nbsp;this&nbsp;set&nbsp;contains&nbsp;another&nbsp;set.</tt></dd></dl>
<dl><dt><a name="Set-symmetric_difference"><strong>symmetric_difference</strong></a>(self, other)</dt><dd><tt>Return&nbsp;the&nbsp;symmetric&nbsp;difference&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;set.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;exactly&nbsp;one&nbsp;of&nbsp;the&nbsp;sets.)</tt></dd></dl>
<dl><dt><a name="Set-union"><strong>union</strong></a>(self, other)</dt><dd><tt>Return&nbsp;the&nbsp;union&nbsp;of&nbsp;two&nbsp;sets&nbsp;as&nbsp;a&nbsp;new&nbsp;set.<br>
&nbsp;<br>
(I.e.&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;in&nbsp;either&nbsp;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>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</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>