title: one or the other in if statement
body: <p>first we have this:</p>
  
  <pre><code>def some(a):
      if a is None or "*":
           print "*"
      else:
           print a
  
  &gt;&gt;&gt; some("*")
      *
  &gt;&gt;&gt; some("d")
      *
  </code></pre>
  
  <p>it failed but I couldn't give myself a good enough reason why it failed.
  Apparently it is because I wrote it wrong, a working version would be:</p>
  
  <pre><code>def some(a):
      if a in [None, "*"]: # or write [ if a is None or a is "*" ]
           print "*"
      else:
           print a
  
  
     &gt;&gt;&gt; some("*")
         *
     &gt;&gt;&gt; some("d")
         d
  </code></pre>
  
  <p>Although it's almost intuitive enough to just write the correct version but I couldn't explain to myself why the first version failed.</p>
  
  <p>so the question is, why the first version failed?</p>