An interesting code for obtaining unique values from a list
<p>Say given a list <code>s = [2,2,2,3,3,3,4,4,4]</code></p>

<p>I saw the following code being used to obtain unique values from s:</p>

<pre><code>unique_s = sorted(unique(s))
</code></pre>

<p>where unique is defined as:</p>

<pre><code>def unique(seq): 
    # not order preserving 
    set = {}
    map(set.__setitem__, seq, []) 
    return set.keys()
</code></pre>

<p>I'm just curious to know if there is any difference between this and just doing list(set(s))? Both results in a mutable object with the same values. </p>

<p>I'm guessing this code is faster since it's only looping once rather than twice in the case of type conversion?</p>
