mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
bpo-40571: Make lru_cache(maxsize=None) more discoverable (GH-20019)
This commit is contained in:
parent
4804b5b3df
commit
21cdb711e3
4 changed files with 57 additions and 1 deletions
|
|
@ -10,7 +10,7 @@
|
|||
# See C source code for _functools credits/copyright
|
||||
|
||||
__all__ = ['update_wrapper', 'wraps', 'WRAPPER_ASSIGNMENTS', 'WRAPPER_UPDATES',
|
||||
'total_ordering', 'cmp_to_key', 'lru_cache', 'reduce',
|
||||
'total_ordering', 'cache', 'cmp_to_key', 'lru_cache', 'reduce',
|
||||
'TopologicalSorter', 'CycleError',
|
||||
'partial', 'partialmethod', 'singledispatch', 'singledispatchmethod',
|
||||
'cached_property']
|
||||
|
|
@ -888,6 +888,15 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
################################################################################
|
||||
### cache -- simplified access to the infinity cache
|
||||
################################################################################
|
||||
|
||||
def cache(user_function, /):
|
||||
'Simple lightweight unbounded cache. Sometimes called "memoize".'
|
||||
return lru_cache(maxsize=None)(user_function)
|
||||
|
||||
|
||||
################################################################################
|
||||
### singledispatch() - single-dispatch generic function decorator
|
||||
################################################################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue