title: Should I use 'has_key()' or 'in' on Python dicts?
body: <p>Given:</p>
  <pre><code>&gt;&gt;&gt; d = {'a': 1, 'b': 2}
  </code></pre>
  <p>Which of the following is the best way to check if <code>'a'</code> is in <code>d</code>?</p>
  <pre><code>&gt;&gt;&gt; 'a' in d
  True
  </code></pre>
  <pre><code>&gt;&gt;&gt; d.has_key('a')
  True
  </code></pre>