summaryrefslogtreecommitdiffstats
path: root/Doc/ref/ref7.tex
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2004-08-17 17:29:16 (GMT)
committerMichael W. Hudson <mwh@python.net>2004-08-17 17:29:16 (GMT)
commit0ccff074cd806bc7e963a1e0ff6ce25e0d11cce9 (patch)
treec8e7be65d3051aa878fe53169b9bdeb4d3b4227e /Doc/ref/ref7.tex
parentb51b23405b6cf82ab4ec20f3d5ef4b895bd0786f (diff)
downloadcpython-0ccff074cd806bc7e963a1e0ff6ce25e0d11cce9.zip
cpython-0ccff074cd806bc7e963a1e0ff6ce25e0d11cce9.tar.gz
cpython-0ccff074cd806bc7e963a1e0ff6ce25e0d11cce9.tar.bz2
This is Mark Russell's patch:
[ 1009560 ] Fix @decorator evaluation order From the description: Changes in this patch: - Change Grammar/Grammar to require newlines between adjacent decorators. - Fix order of evaluation of decorators in the C (compile.c) and python (Lib/compiler/pycodegen.py) compilers - Add better order of evaluation check to test_decorators.py (test_eval_order) - Update the decorator documentation in the reference manual (improve description of evaluation order and update syntax description) and the comment: Used Brett's evaluation order (see http://mail.python.org/pipermail/python-dev/2004-August/047835.html) (I'm checking this in for Anthony who was having problems getting SF to talk to him)
Diffstat (limited to 'Doc/ref/ref7.tex')
-rw-r--r--Doc/ref/ref7.tex12
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/ref/ref7.tex b/Doc/ref/ref7.tex
index 1d7b860..88c548c 100644
--- a/Doc/ref/ref7.tex
+++ b/Doc/ref/ref7.tex
@@ -318,9 +318,9 @@ section~\ref{types}):
{[\token{decorators}] "def" \token{funcname} "(" [\token{parameter_list}] ")"
":" \token{suite}}
\production{decorators}
- {\token{decorator} ([NEWLINE] \token{decorator})* NEWLINE}
+ {\token{decorator}+}
\production{decorator}
- {"@" \token{dotted_name} ["(" [\token{argument_list} [","]] ")"]}
+ {"@" \token{dotted_name} ["(" [\token{argument_list} [","]] ")"] NEWLINE}
\production{parameter_list}
{(\token{defparameter} ",")*}
\productioncont{("*" \token{identifier} [, "**" \token{identifier}]}
@@ -352,11 +352,11 @@ Decorator expressions are evaluated when the function is defined, in the scope
that contains the function definition. The result must be a callable,
which is invoked with the function object as the only argument.
The returned value is bound to the function name instead of the function
-object. If there are multiple decorators, they are applied in reverse
-order. For example, the following code:
+object. Multiple decorators are applied in nested fashion.
+For example, the following code:
\begin{verbatim}
-@f1
+@f1(arg)
@f2
def func(): pass
\end{verbatim}
@@ -365,7 +365,7 @@ is equivalent to:
\begin{verbatim}
def func(): pass
-func = f2(f1(func))
+func = f1(arg)(f2(func))
\end{verbatim}
When one or more top-level parameters have the form \var{parameter}