| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 """ | 5 """ |
| 6 Collection of decorators to help optimize Python functions and classes | 6 Collection of decorators to help optimize Python functions and classes |
| 7 by caching return values. | 7 by caching return values. |
| 8 | 8 |
| 9 Return values are (by default) keyed off of the function's parameters. | 9 Return values are (by default) keyed off of the function's parameters. |
| 10 Consequently, any parameters that are used in memoization must be hashable. | 10 Consequently, any parameters that are used in memoization must be hashable. |
| 11 | 11 |
| 12 This library offers two styles of memoization: | 12 This library offers two styles of memoization: |
| 13 1) Absolute memoization (memo) uses the full set of parameters against a | 13 1) Absolute memoization (memo) uses the full set of parameters against a |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 Args: | 180 Args: |
| 181 ignore: (list) The names of parameters to ignore when memoizing. | 181 ignore: (list) The names of parameters to ignore when memoizing. |
| 182 """ | 182 """ |
| 183 def wrap(func): | 183 def wrap(func): |
| 184 return MemoizedFunction( | 184 return MemoizedFunction( |
| 185 func, | 185 func, |
| 186 ignore=ignore, | 186 ignore=ignore, |
| 187 memo_dict=memo_dict, | 187 memo_dict=memo_dict, |
| 188 ) | 188 ) |
| 189 return wrap | 189 return wrap |
| OLD | NEW |