title: Python line_profiler code example
body: <p>I am trying to figure out how I can run Python's <a href="https://pypi.python.org/pypi/line_profiler" rel="noreferrer">line_profiler</a> to get the line by line execution times in the format given in the answer to <a href="https://stackoverflow.com/questions/3927628/how-can-i-profile-python-code-line-by-line/3927671#3927671">this question</a>.</p>
  
  <p>I installed the module and am calling its <code>LineProfiler</code> object as below but the output I get is just a single time and not a line by line summary. </p>
  
  <p>Any ideas? Furthermore, how can I get the time for the <code>numbers = [random.randint(1,100) for i in range(1000)]</code> line that is outside any function?</p>
  
  <pre><code>from line_profiler import LineProfiler
  import random
  
  def do_stuff(numbers):
  
      s = sum(numbers)
      l = [numbers[i]/43 for i in range(len(numbers))]
      m = ['hello'+str(numbers[i]) for i in range(len(numbers))]
  
  numbers = [random.randint(1,100) for i in range(1000)]
  profile = LineProfiler(do_stuff(numbers))
  profile.print_stats()
  [] Timer unit: 3.20721e-07 s
  </code></pre>