Decorators proposal
Christopher T King
squirrel at WPI.EDU
Tue Aug 10 13:02:50 EDT 2004
On Tue, 10 Aug 2004, Daniel Dittmar wrote:
> RebelGeekz wrote:
> > Just my humble opinion:
> >
> > def bar(low,high):
> > meta:
> > accepts(int,int)
> > returns(float)
> > #more code
>
> +1
>
> This also allows to set function properties inside of the function
> def handler (match):
> meta:
> pattern = re.compile (...)
Ooh, perty! I especially like the extension of this idea into function
attributes; it looks even cleaner than the .attribute syntax I like.
The only problem I see with this is that Guido seems to want decorators to
be more prominent than the function signature itself, so he probably
certainly won't go for "hiding" then in a doubly-nested block. (I write
"hiding" in quotes because I'm of the opinion that placing decorators
after a one- or two-line function signature does nothing to obscure the
decorators.)
More information about the Python-list
mailing list