summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/decorator.py2
-rw-r--r--src/tests/documentation.py10
2 files changed, 10 insertions, 2 deletions
diff --git a/src/decorator.py b/src/decorator.py
index 7a8b232..b9d3732 100644
--- a/src/decorator.py
+++ b/src/decorator.py
@@ -33,7 +33,7 @@ for the documentation.
"""
from __future__ import print_function
-__version__ = '4.0.2'
+__version__ = '4.0.3'
import re
import sys
diff --git a/src/tests/documentation.py b/src/tests/documentation.py
index 81602c8..8156e3c 100644
--- a/src/tests/documentation.py
+++ b/src/tests/documentation.py
@@ -147,11 +147,14 @@ that depends on non-hashable arguments):
$$memoize_uw
-Here i used the functools.update_wrapper_ utility, which has
+Here I used the functools.update_wrapper_ utility, which has
been added in Python 2.5 expressly to simplify the definition of decorators
(in older versions of Python you need to copy the function attributes
``__name__``, ``__doc__``, ``__module__`` and ``__dict__``
from the original function to the decorated function by hand).
+Here is an example of usage:
+
+$$f1
.. _functools.update_wrapper: https://docs.python.org/3/library/functools.html#functools.update_wrapper
@@ -1230,6 +1233,11 @@ def _memoize(func, *args, **kw):
def memoize(f):
+ """
+ A simple memoize implementation. It works by adding a .cache dictionary
+ to the decorated function. The cache will grow indefinitely, so it is
+ your responsability to clear it, if needed.
+ """
f.cache = {}
return decorate(f, _memoize)