title: Python comparison operation, if and None
body: <p>I was reading some code and I noticed that this code has many of these lines:</p>
  
  <pre><code> try: 
     rv = somefunction()
   except SomeException, e:
     rv = 0
  
   if rv == 0:
      doSomething() ...
  </code></pre>
  
  <p>It seemed to me that using this style of comparison operations is bound to be slower than:</p>
  
  <pre><code>try: 
     rv = somefunction()
   except SomeException, e:
     rv = None
  
   if is not None:
      doSomething() 
      ...
  </code></pre>