When Retrier succeeds, record errors it encountered.
[chromium-blink-merge.git] / tools / json_schema_compiler / memoize.py
blob1402a6ecd80990db3192a92be40d71f67f24fabb
1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 def memoize(fn):
6 '''Decorates |fn| to memoize.
7 '''
8 memory = {}
9 def impl(*args):
10 if args not in memory:
11 memory[args] = fn(*args)
12 return memory[args]
13 return impl