summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew/whatsnew24.tex
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2004-12-26 15:29:28 (GMT)
committerSkip Montanaro <skip@pobox.com>2004-12-26 15:29:28 (GMT)
commit9935e7fac018b5b24463efcde61db0ced4d4b37d (patch)
tree43a9413c63103eca7db8ff2ce058313180b603f8 /Doc/whatsnew/whatsnew24.tex
parent2eba0d6eb20700dbb3b45c43a406a5944668d084 (diff)
downloadcpython-9935e7fac018b5b24463efcde61db0ced4d4b37d.zip
cpython-9935e7fac018b5b24463efcde61db0ced4d4b37d.tar.gz
cpython-9935e7fac018b5b24463efcde61db0ced4d4b37d.tar.bz2
correct decorator example, tweak description slightly
Diffstat (limited to 'Doc/whatsnew/whatsnew24.tex')
-rw-r--r--Doc/whatsnew/whatsnew24.tex26
1 files changed, 15 insertions, 11 deletions
diff --git a/Doc/whatsnew/whatsnew24.tex b/Doc/whatsnew/whatsnew24.tex
index 3bb087a..3c98aa6 100644
--- a/Doc/whatsnew/whatsnew24.tex
+++ b/Doc/whatsnew/whatsnew24.tex
@@ -289,7 +289,9 @@ The \code{@classmethod} is shorthand for the
the following:
\begin{verbatim}
-@A @B @C
+@A
+@B
+@C
def f ():
...
\end{verbatim}
@@ -301,16 +303,18 @@ def f(): ...
f = A(B(C(f)))
\end{verbatim}
-Decorators must come on the line before a function definition, and
-can't be on the same line, meaning that \code{@A def f(): ...} is
-illegal. You can only decorate function definitions, either at the
-module level or inside a class; you can't decorate class definitions.
-
-A decorator is just a function that takes the function to be decorated
-as an argument and returns either the same function or some new
-callable thing. It's easy to write your own decorators. The
-following simple example just sets an attribute on the function
-object:
+Decorators must come on the line before a function definition, one decorator
+per line, and can't be on the same line as the def statement, meaning that
+\code{@A def f(): ...} is illegal. You can only decorate function
+definitions, either at the module level or inside a class; you can't
+decorate class definitions.
+
+A decorator is just a function that takes the function to be decorated as an
+argument and returns either the same function or some new object. The
+return value of the decorator need not be callable (though it typically is),
+unless further decorators will be applied to the result. It's easy to write
+your own decorators. The following simple example just sets an attribute on
+the function object:
\begin{verbatim}
>>> def deco(func):