title: When would you use reduce() instead of sum()?
body: <p>I began learning functional programming recently, and came up with this example when attempting to calculate my quiz average for a class.</p>
  
  <p>The example I came up with is:</p>
  
  <pre><code>scores = [90, 91, 92, 94, 95, 96, 97, 99, 100]
  
  def add(num1, num2):
      '''returns the sum of the parameters'''
      return num1 + num2
  
  import operator 
  
  timeit reduce(add, scores) / len(scores)  #--&gt; 1000000 loops, best of 3: 799 ns per loop
  
  timeit sum(scores) / len(scores)  #--&gt; 1000000 loops, best of 3: 207 ns per loop
  
  timeit reduce(operator.add, scores) / len(scores) #--&gt; 1000000 loops, best of 3: 485 ns per loop
  </code></pre>
  
  <p>It would seem that in the example above, using an higher order function is almost 4 times slower.</p>
  
  <p>So my questions is, when would be a good time to use an higher-order function, because clearly the example above it is not? </p>