title: Checking if a key in dict is defined or not
body: <p>So I have a <code>P = dict()</code>. I have the following code:</p>
  
  <pre><code>def someFunction():
      P['key'] += 1
      '''do other task'''
  </code></pre>
  
  <p>What is the simplest way to check if <code>P['key']</code>  is defined or not?</p>
  
  <p>I checked <a href="https://stackoverflow.com/questions/843277/how-do-i-check-if-a-variable-exists-in-python">How do I check if a variable exists?</a> but I am not sure if that answers my question.</p>