Re: pep 318, Decorators for Functions, Methods and Classes
Mark Hahn <[email protected]> Tue, 10 Aug 2004 19:07:19 -0700
| Newsgroups | gmane.comp.lang.prothon.user,gmane.comp.python.devel |
|---|---|
| Organization | Hahn Creative Applications |
| Message-ID | <[email protected]> |
On Tue, 10 Aug 2004 10:25:53 -0500, Skip Montanaro wrote:
> (still catching up...)
>
> Simon> I just wanted to say that I believe it should be allowed to
> Simon> decorate classes. There's not reason enough (reading the thread
> Simon> linked to by the PEP) to limit decorators this way. Like said
> Simon> several times in that thread, metaclasses are harder (to write
> Simon> and to understand) than decorators.
>
> While it might be perceived as a limitation there's nothing preventing its
> addition in a later version if warranted. I believe most/all the various
> proposals on the PythonDecorators wiki, not just the pie syntax, could be
> easily adapted to class decoration.
I don't know if this is the right place to ask this question, but I'm
implementing Prothon to only use decorators for docstrings and not using
the old string standard. This means Prothon will have to have class and
module decorators.
Class decorators are no problem but does anyone have a clue how I should
implement module decorators? To be totally consistent I should add:
@doc("""this is a module docstring""")
module foo:
module contents
blah blah blah
The idea of indenting the entire module really bothers me though. I was
thinking I could cheat and just leave the suite off entirely and make the
module command be a "naming" keyword that reduntantly matches the filename:
@doc("""this is a module docstring""")
module foo
module contents
blah blah blah
Anyone have any better ideas?