title: Determine if variable is defined in Python
body: <p>How do you know whether a variable has been set at a particular place in the code at runtime? This is not always obvious because (1) the variable could be conditionally set, and (2) the variable could be conditionally deleted. I'm looking for something like <code>defined()</code> in Perl or <code>isset()</code> in PHP or <code>defined?</code> in Ruby.</p>
  
  <pre><code>if condition:
      a = 42
  
  # is "a" defined here?
  
  if other_condition:
      del a
  
  # is "a" defined here?
  </code></pre>