def accum_time(L):
  """
  Add time used inside a with block to the value of L[0].
  """
  start = time.clock()
  try:
    yield
  finally:
    end = time.clock()
    L[0] += end - start

  Add time used inside a with block to the value of L[0].
  
recipes/Python/498113_Time_sections_code_using/recipe-498113.py