title: python-measure function time
body: <p>I am having a problem with measuring the time of a function.</p>
  
  <p>My function is a "linear search":</p>
  
  <pre><code>def linear_search(obj, item,):
      for i in range(0, len(obj)):
          if obj[i] == item:
          return i
      return -1
  </code></pre>
  
  <p>And I made another function that measures the time 100 times and adds all the results to a list:</p>
  
  <pre><code>def measureTime(a):
      nl=[]
      import random
      import time
      for x in range(0,100): #calculating time
          start = time.time() 
          a   
          end =time.time()
          times=end-start
          nl.append(times)
      return nl
  </code></pre>
  
  <p>When I'm using <code>measureTime(linear_search(list,random.choice(range(0,50))))</code>, the function always returns <code>[0.0]</code>.</p>
  
  <p>What can cause this problem? Thanks.</p>