@decorators

Mark Bottjer mark_bottjer at hotmail.com
Fri Aug 6 22:19:18 CEST 2004


Roy Smith wrote:
> I really dislike the proposed syntax, for two main reasons.  First, I 
> don't like the idea of inventing new uses for punctuation (down that 
> road lies perl).

Eh. After print >>, it doesn't seem so bad :). And I *like* the fact 
that it doesn't look like a normal statement, because it *isn't* a 
normal statement. This could also be accomplished with a keyword, but 
I've yet to hear one that makes sense in all usages.

> Second, I don't like the idea that you're creating a 
> contextual block which violates (or at least ignores) the normal 
> indenting rules.

Bingo! That is my biggest problem with this syntax. If it were just 
moved inside the function definition, like the docstring, I'd be *so* 
much happier...

> I'm also wondering about doc strings.  Doc strings are really metadata, 
> and if the idea of decorators is to build a uniform way to handle 
> metadata, it would be nice to see it somehow include docstrings.

I'm not sure docstrings need to change. The do what they do pretty well 
(though I'd like to be able to parse them a bit more easily). @dec isn't 
just about metadata, though: its about *any* sort of modification to the 
default function object def creates. Metadata is one of the more common 
uses, to be sure, but by no means the only one. In short, I see no need 
to bring the docstring into this.

   -- Mark



More information about the Python-list mailing list