def ... decorate
Paul Rubin
http
Fri Aug 13 13:49:06 EDT 2004
Roman Suzi <rnd at onego.ru> writes:
> Bingo!
>
> Just replace decorate with "from" and the nice syntax is found:
>
> def f:
> staticmethod
> grammarrule('statement : expression')
> version("Added in 2.4")
> deprecatedmethod
> type_(None)
> from self, p:
> """docstring here"""
> print p[1]
You can get rid of the keyword:
> def f:
> staticmethod
> grammarrule('statement : expression')
> version("Added in 2.4")
> deprecatedmethod
> type_(None)
> (self, p):
> """docstring here"""
> print p[1]
The syntax is if you see f without parentheses, what follows is decorators.
The outdent before the arg list makes it obvious where the arg list is.
More information about the Python-list
mailing list