[Python-Dev] method decorators (PEP 318)

Alexis Layton alexis.layton at post.harvard.edu
Sat Mar 27 13:05:53 EST 2004


Hi folks.

If there is going to be a distinction between “transforming” and 
”annotative”
decorators, then I think this syntax makes the most sense:

def [classmethod] my_wonderful_method(arg1, arg2):
	:author: "Eric Idle"
	:skit: "The Python Decorator Skit"
	:xyzzy: getNextXyzzy()
	:doc: """doc"""
	pass

Wether these annotations are put into the function dict, or 
function.__meta__
is an implementation detail.  I would like to suggest that either a 
traditional
doc string or the annotation block appear after a def, but not both.

Annotation names should be limited to identifier syntax, probably?

I understand Guido has stated that he doesn't like to separate the def 
from the funcname
because it could be hard to find, especially with long decorator 
chains.  But if only
transforming decorators are used here, it's my impression that they 
will tend to be short.
Secondly, with transforming decorators, the meaning of the function 
depends on the
transformation; I find "def [classmethod]" reads quite well.
----
Alexis Layton
2130 Massachusetts Ave.
Apt. 6E
Cambridge, MA  02140-1917
alexis.layton at post.harvard.edu




More information about the Python-Dev mailing list