title: Python - timeit doesn't stop
body: <p>I use Python3, Ubuntu 14.04 to run the following snippet. The timing() function never terminate. I suppose it is due to the Timer() function. Why? How can I fix it?</p>
  
  <pre><code>import subprocess
  
  def timing():
      args = ("./a.out")
      print('start')
      popen = subprocess.Popen(args, stdout=subprocess.PIPE)
      popen.wait()    
      print('end')
  
  if __name__ == '__main__':
      import timeit
      print('main')
      t=timeit.Timer("timing()","from __main__ import timing")
      print(t.timeit())
  </code></pre>
  
  <p>In the terminal, it shows:</p>
  
  <pre><code>main
  start
  end
  start
  end
  start
  ...
  </code></pre>
  
  <p>The skeleton of the code is from <a href="https://stackoverflow.com/a/2662147/2431648">this answer</a>.</p>