random --> arbitrary (thanks Lorenzo)

This commit is contained in:
Mark Pilgrim
2009-11-04 14:58:39 -05:00
parent 7b5f0c989c
commit 50e5f30368
+1 -1
View File
@@ -711,7 +711,7 @@ KeyError: 21</samp></pre>
File "&lt;stdin>", line 1, in &lt;module>
KeyError: 'pop from an empty set'</samp></pre>
<ol>
<li>The <code>pop()</code> method removes a single value from a set and returns the value. However, since sets are unordered, there is no &#8220;last&#8221; value in a set, so there is no way to control which value gets removed. It is essentially random.
<li>The <code>pop()</code> method removes a single value from a set and returns the value. However, since sets are unordered, there is no &#8220;last&#8221; value in a set, so there is no way to control which value gets removed. It is completely arbitrary.
<li>The <code>clear()</code> method removes <em>all</em> values from a set, leaving you with an empty set. This is equivalent to <code>a_set = set()</code>, which would create a new empty set and overwrite the previous value of the <var>a_set</var> variable.
<li>Attempting to pop a value from an empty set will raise a <code>KeyError</code> exception.
</ol>