title: De-duplicate a list of objects in python
body: <p>How can I de-duplicate a list of objects in python, such that
  <code>list_of_objects[i] is list_of_objects[j]</code> returns <code>true</code> if and only if <code>i == j</code>?</p>
  
  <p>Example:</p>
  
  <p>I have two clusters of numbers, and I build a dictionary with the number as key, and the value as cluster</p>
  
  <pre><code>a = {1,2,3}
  b = {4,5,6}
  cur_dict = {1:a, 2:a, 3:a, 4:b, 5:b, 6:b}
  duplicated_clusters = list(cur_dict.values())
  duplicated_clusters
  # [{1, 2, 3}, {1, 2, 3}, {1, 2, 3}, {4, 5, 6}, {4, 5, 6}, {4, 5, 6}]
  # How to process duplicated_clusters to get [{1, 2, 3}, {4, 5, 6}]?
  
  # Obviously set(duplicated_clusters) is not working because set is not hashable and mutable. 
  </code></pre>
  
  <p>Since there is no pointer in python, how do I obtain a list of de-duplicated objects (or is it unachievable)? (I can think of some workarounds but it's not straight-forward to me, such as using extra identifiers or wrapping each object into a wrapper class). </p>
  
  <pre><code># An example workaround but I want to have a more straight-forward way
  a = {1,2,3}
  b = {4,5,6}
  cluster_dict = {"clusterA": a, "clusterB": b}
  cur_dict = {1:"clusterA", 2:"clusterA", 3:"clusterA", 4:"clusterB", 5:"clusterB", 6:"clusterB"}
  duplicated_cluster_names = list(cur_dict.values())
  deduplicated_clusters = [cluster_dict[name] for name in set(duplicated_cluster_names)]
  deduplicated_clusters
  # [{1, 2, 3}, {4, 5, 6}]
  </code></pre>
  
  <p>Example 2:</p>
  
  <p>Added an example for better clarity, thanks to @wjandrea comments. </p>
  
  <pre><code>a = {1,2,3}
  b = {4,5,6}
  c = {1,2,3}
  duplicated_clusters = [a,a,b,b,c,c]
  duplicated_clusters
  # [{1, 2, 3}, {1, 2, 3}, {4, 5, 6}, {4, 5, 6}, {1, 2, 3}, {1, 2, 3}]
  # Deduplicated clusters I want to obtain: [{1, 2, 3}, {4, 5, 6}, {1, 2, 3}], equivalent to [a,b,c]
  
  </code></pre>