You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Decorator to wrap a function with a memoizing callable that saves up to the
46
46
*maxsize* most recent calls. It can save time when an expensive or I/O bound
@@ -52,6 +52,10 @@ The :mod:`functools` module defines the following functions:
52
52
If *maxsize* is set to None, the LRU feature is disabled and the cache
53
53
can grow without bound.
54
54
55
+
If *typed* is set to True, function arguments of different types will be
56
+
cached separately. For example, ``f(3)`` and ``f(3.0)`` will be treated
57
+
as distinct calls with distinct results.
58
+
55
59
To help measure the effectiveness of the cache and tune the *maxsize*
56
60
parameter, the wrapped function is instrumented with a :func:`cache_info`
57
61
function that returns a :term:`named tuple` showing *hits*, *misses*,
@@ -67,8 +71,8 @@ The :mod:`functools` module defines the following functions:
67
71
68
72
An `LRU (least recently used) cache
69
73
<http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used>`_ works
70
-
best when more recent calls are the best predictors of upcoming calls (for
71
-
example, the most popular articles on a news server tend to change daily).
74
+
best when the most recent calls are the best predictors of upcoming calls (for
75
+
example, the most popular articles on a news server tend to change each day).
72
76
The cache's size limit assures that the cache does not grow without bound on
73
77
long-running processes such as web servers.
74
78
@@ -111,6 +115,9 @@ The :mod:`functools` module defines the following functions:
111
115
112
116
.. versionadded:: 3.2
113
117
118
+
.. versionchanged:: 3.3
119
+
Added the *typed* option.
120
+
114
121
.. decorator:: total_ordering
115
122
116
123
Given a class defining one or more rich comparison ordering methods, this
0 commit comments