[Python-Dev] Re: def ... decorate
Werner Schiendl
ws-news at gmx.at
Fri Aug 13 19:52:48 CEST 2004
[Skip]
>
> def p_statement_expr:
> staticmethod
> grammarrule('statement : expression')
> version("Added in 2.4")
> deprecatedmethod
> type_(None)
> decorate (self, p):
> """docstring here"""
> print p[1]
>
was the following suggested already? (don't think so):
def p_statement_expr(self, p):
staticmethod
grammarrule('statement : expression')
version("Added in 2.4")
deprecatedmethod
type_(None)
body:
"""docstring here"""
print p[1]
This would eliminate the problem of the moved parameters, yet keep all the
pros you listed.
The docstring could allowed to be with the decorators so that all
"meta-data" (from the perspective of a user) would be together.
/ Werner
More information about the Python-Dev
mailing list