[Python-checkins] python/nondist/peps pep-0318.txt,1.18,1.19
montanaro at users.sourceforge.net
montanaro at users.sourceforge.net
Fri Aug 6 20:34:17 CEST 2004
Update of /cvsroot/python/python/nondist/peps
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21415
Modified Files:
pep-0318.txt
Log Message:
add Guido's comment about nested decorator problems
Index: pep-0318.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0318.txt,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** pep-0318.txt 6 Aug 2004 16:02:42 -0000 1.18
--- pep-0318.txt 6 Aug 2004 18:34:15 -0000 1.19
***************
*** 230,233 ****
--- 230,251 ----
it would require the introduction of a new keyword.
+ The obvious alternative that nests the function within the block
+
+ ::
+
+ using:
+ dec1
+ dec2
+ ...
+ def foo(arg1, arg2, ...):
+ pass
+
+ has its own set of drawbacks. Having the minimal indent level be
+ three deep for methods is painful for those using limited-width
+ windows. The inconsistent indentation between methods of the same
+ class with and without decorators would be a readability problem.
+ Finally, adding or removing decorators would require reindenting the
+ entire function/method body.
+
Guido proposed and implementated a patch to support interpretation of
a `list of decorators`_ as a prefix to function definitions ::
***************
*** 286,290 ****
@ was previously unused as a token in Python also means it's clear
there is no possibility of such code being parsed by an earlier
! version of Python, leading to possibly subtle semantic bugs.
For syntax options which use a list-like syntax (no matter where it
--- 304,310 ----
@ was previously unused as a token in Python also means it's clear
there is no possibility of such code being parsed by an earlier
! version of Python, leading to possibly subtle semantic bugs. That
! said, @ is still a fairly arbitrary choice. Some have suggested using
! | instead.
For syntax options which use a list-like syntax (no matter where it
More information about the Python-checkins
mailing list