title: Decorator makes functions return None
body: <p>I built two functions to find prime factors.  One version is slower than the other function on large number.  I would like to evaluate the running time of those two functions.  to do so I built a decorator to evaluate the time eclipsed.
  Since I plug the decorator my two functions return <code>None</code>. What is wrong in my code?</p>
  
  <pre><code>import math
  import time
  
  def time_usage(func):
      def wrapper(*args, **kwargs):
          beg_ts = time.time()
          func(*args, **kwargs)
          end_ts = time.time()
          print("[INFO] elapsed time: %f" % (end_ts - beg_ts))
      return wrapper
  
  @time_usage
  def find_factors(n):
      factors = []
      i = 2
      while i &lt; n:
          while (n % i) == 0:
              factors.append(i)
              n /= i
          i += 1
      if n &gt; 1:
          factors.append(n)
      return factors
  
  @time_usage
  def improved_prime_factor(n):
      factors = []
      # No need to test whether the number is divisible by any 
      # even number other than 2
      while n % 2 == 0:
          factors.append(2)
          n /= 2
      i = 3
      # If n = p * q, either p or q must be &lt;= sqrt(n)
      max_factor = math.sqrt(n)
      while i &lt;= max_factor:
          while n % i == 0:
              factors.append(i)
              n /= i
              # Update the upper band on possible factors
              max_factor = math.sqrt(n)
          i += 2
      if n &gt; 1:
          factors.append(n)
      return factors
  
  if __name__ == '__main__':
      print(improved_prime_factor(125556))  # return None
      print(find_factors(125556)) # return None
  </code></pre>