title: Why is list+set method of making a list unique faster than dictionary keys method?
body: <p>Here is a sample of timeit trial for the same:</p>
  
  <pre><code>&gt;&gt;&gt; import timeit
  &gt;&gt;&gt; setup = """
  ... from random import randint
  ... rand_list = [randint(0,10) for i in range(0,10000)]
  ... """
  
  &gt;&gt;&gt; timeit.Timer('list(set(rand_list))', setup=setup).repeat(5, 1000)
  [0.17256593704223633, 0.17117094993591309, 0.17115998268127441, 0.17191100120544434, 0.17226791381835938]
  &gt;&gt;&gt; timeit.Timer('{ x:True for x in rand_list}.keys()', setup=setup).repeat(5, 1000)
  [0.4490840435028076, 0.44455599784851074, 0.442918062210083, 0.4430229663848877, 0.44559407234191895]
  </code></pre>
  
  <p>As you can see, the list(set(MY_LIST)) method is approximately 2.5 times faster than dictionary method, the result is similar for smaller lists or bigger lists.</p>
  
  <p>Can anyone please explain why this is so i.e. the difference in functionality of execution of both these steps in terms of time complexity ?</p>