[Python-checkins] python/dist/src/Doc/ref ref7.tex,1.39,1.40
mwh at users.sourceforge.net
mwh at users.sourceforge.net
Tue Aug 17 19:29:35 CEST 2004
Update of /cvsroot/python/python/dist/src/Doc/ref
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1056/Doc/ref
Modified Files:
ref7.tex
Log Message:
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)
Index: ref7.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref7.tex,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** ref7.tex 2 Aug 2004 06:09:52 -0000 1.39
--- ref7.tex 17 Aug 2004 17:29:13 -0000 1.40
***************
*** 319,325 ****
":" \token{suite}}
\production{decorators}
! {\token{decorator} ([NEWLINE] \token{decorator})* NEWLINE}
\production{decorator}
! {"@" \token{dotted_name} ["(" [\token{argument_list} [","]] ")"]}
\production{parameter_list}
{(\token{defparameter} ",")*}
--- 319,325 ----
":" \token{suite}}
\production{decorators}
! {\token{decorator}+}
\production{decorator}
! {"@" \token{dotted_name} ["(" [\token{argument_list} [","]] ")"] NEWLINE}
\production{parameter_list}
{(\token{defparameter} ",")*}
***************
*** 353,361 ****
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:
\begin{verbatim}
! @f1
@f2
def func(): pass
--- 353,361 ----
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. Multiple decorators are applied in nested fashion.
! For example, the following code:
\begin{verbatim}
! @f1(arg)
@f2
def func(): pass
***************
*** 366,370 ****
\begin{verbatim}
def func(): pass
! func = f2(f1(func))
\end{verbatim}
--- 366,370 ----
\begin{verbatim}
def func(): pass
! func = f1(arg)(f2(func))
\end{verbatim}
More information about the Python-checkins
mailing list