def ... decorate

Anthony Baxter anthonybaxter at
Fri Aug 13 18:59:07 CEST 2004

On Fri, 13 Aug 2004 20:55:39 +0400 (MSD), Roman Suzi <rnd at> wrote:
> 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]

I _really_ _really_ dislike re-using 'from' in this way. It's really confusing.

I also don't like the way it's splitting the argument list out like
that. It's a _big_
change from how things work today, and will break pretty much _every_
tool that works with Python source, and badly.

For instance, I often end up doing some equivalent of "grep 'def funcname'"
and like the fact that I get the start (at least) of the argument
list. More often
than not, I get the full argument list, which is what I was looking for in the 
first place.

More information about the Python-list mailing list