title: Why use dict.keys?
body: <p>I recently wrote some code that looked something like this:</p>
  
  <pre><code># dct is a dictionary
  if "key" in dct.keys():
  </code></pre>
  
  <p>However, I later found that I could achieve the same results with:</p>
  
  <pre><code>if "key" in dct:
  </code></pre>
  
  <p>This discovery got me thinking and I began to run some tests to see if there could be a scenario when I <em>must</em> use the <code>keys</code> method of a dictionary.  My conclusion however is no, there is not.</p>
  
  <p>If I want the keys in a list, I can do:</p>
  
  <pre><code>keys_list = list(dct)
  </code></pre>
  
  <p>If I want to iterate over the keys, I can do:</p>
  
  <pre><code>for key in dct:
      ...
  </code></pre>
  
  <p>Lastly, if I want to test if a key is in <code>dct</code>, I can use <code>in</code> as I did above.</p>
  
  <p>Summed up, my question is: am I missing something?  Could there ever be a scenario where I <em>must</em> use the <code>keys</code> method?...or is it simply a leftover method from an earlier installation of Python that should be ignored?</p>