A decorator syntax not yet mentioned (I think!)

Michael Sparks zathras at thwackety.com
Thu Aug 12 20:14:58 EDT 2004


On Thu, 12 Aug 2004, Mark Bottjer wrote:

> FWIW, I agree. That's why I like this option the best:
>
> class C:
>    def c(self):
>      meta: #declare, decorate, transform, fubar, whatever...
>        staticmethod
>        doc('Doc.')
>      pass

FWIW, I _personally_ prefer this approach, and the reason I implemented J2
was solely because I went a) "oooh", b) it looks like it has the same
advantages as the @pies c) the number of times it's been pointed out that
syntaxes with decorators inside the function won't go anywhere, d) The
wiki page said (sorta) that it couldn't be  done.

I can quite happily live with the @pie syntax, but _personally_ I find J2
clearer than @pie (and the above syntax you provide clearer still) and it
also gives someone a keyword to lookup when reading code with it, rather
than searching for punctuation. (punctuation also strikes me as more
user/newbie hostile, but again, that's taste)


Michael.




More information about the Python-list mailing list