title: Is a chained if...else expression in python faster than if..elif..else statements?
body: <p>I wrote this quick test script to check, but I only have access to a bash console on pythonanywhere right now, and I am not getting consistent times.</p>
  
  <pre><code>def a():
      x = 0
      for i in xrange(1000):
          if i%2==0 and i%3==0:
              x += 3
          elif i%2==0 or i%3==0:
              x += 2
          else:
              x += 1
  
  def b():
      x = 0
      for i in xrange(1000):
          x += 3 if i%2==0 and i%3==0 else (2 if i%2==0 or i%3==0 else 1)
  
  if __name__=="__main__":
      import cProfile
      cProfile.run("for i in xrange(1000): a()")
      cProfile.run("for i in xrange(1000): b()")
  </code></pre>
  
  <p>I'm looking to speed up some code, and I am wondering if there is any big speed difference between these two different ways of doing it.</p>