summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichele Simionato <michele.simionato@gmail.com>2015-09-25 04:22:07 +0200
committerMichele Simionato <michele.simionato@gmail.com>2015-09-25 04:22:07 +0200
commit705cfa854bfa3bc44494d1d985cff1d01e270ae9 (patch)
tree7c4e3232a70b084d4b1e7d9b692ce16df3e3f5cd /src
parente13cf0704b7c28f1de1e71cb7c59b47a84daa9ca (diff)
parentf1d2835e2745b19e8d984c0cb7defd527bd9e9e2 (diff)
downloadpython-decorator-git-705cfa854bfa3bc44494d1d985cff1d01e270ae9.tar.gz
Merge pull request #16 from micheles/4.0.3
Release 4.0.3
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)