text: #!/usr/bin/env python3
  # encoding: utf-8
  """
  """
  
  # end_pymotw_header
  import functools
  
  
  def do_reduce(a, b):
      print("do_reduce({}, {})".format(a, b))
      return a + b
  
  
  print("Single item in sequence:", functools.reduce(do_reduce, [1]))
  
  print("Single item in sequence with initializer:", functools.reduce(do_reduce, [1], 99))
  
  print("Empty sequence with initializer:", functools.reduce(do_reduce, [], 99))
  
  try:
      print("Empty sequence:", functools.reduce(do_reduce, []))
  except TypeError as err:
      print("ERROR: {}".format(err))
  