title: Is it safe to rely on condition evaluation order in if statements?
body: <p>Is it bad practice to use the following format when <code>my_var</code> can be None?</p>
  
  <pre><code>if my_var and 'something' in my_var:
      #do something
  </code></pre>
  
  <p><em>The issue is that <code>'something' in my_var</code> will throw a TypeError if my_var is None.</em></p>
  
  <p>Or should I use:</p>
  
  <pre><code>if my_var:
      if 'something' in my_var:
          #do something
  </code></pre>
  
  <p>or </p>
  
  <pre><code>try:
      if 'something' in my_var:
          #do something
  except TypeError:
      pass
  </code></pre>
  
  <p>To rephrase the question, which of the above is the best practice in Python (if any)?</p>
  
  <p>Alternatives are welcome!</p>