title: Python loop slower than Excel VBA?
body: <p>I ran a little test between excel (VBA) and python performing a simple loop. Code listed below. To my surprise vba was significantly faster than python. Almost 6 times faster. I though that due to the fact that python runs through the command line the performance would be better. Do you guys have any comments on this?</p>
  
  <p>Python</p>
  
  <pre><code>import time
  import ctypes  # An included library with Python install.
  start_time = time.time()
  
  for x in range(0, 1000000):
      print x
  
  x = ("--- %s seconds ---" % (time.time() - start_time))
  ctypes.windll.user32.MessageBoxA(0, x, "Your title", 1)
  </code></pre>
  
  <p>Excel (VBA)</p>
  
  <pre><code>Sub looptest()
  
  Dim MyTimer As Double
  
  MyTimer = Timer
  
  Dim rng As Range, cell As Range
  Set rng = Range("A1:A1000000")
  
  x = 1
  For Each cell In rng
  
      cell.Value = x
      x = x + 1
  Next cell
  
  
  MsgBox Timer - MyTimer
  End Sub
  </code></pre>