[Python-ideas] wild idea : target decorators

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Sep 25 04:20:06 CEST 2009

Guido van Rossum wrote:
> On Thu, Sep 24, 2009 at 5:38 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>>  @fancy_property
>>  foo = 'The fancy foo property'
> How did one occurrence of 'foo' suddenly turn into foo (without
> quotes)? That's not how decorators behave elsewhere.

Decorators on assignments would have to be defined slightly
differently, since as you point out, they wouldn't gain
you anything otherwise.

If you would prefer to use some syntax other than @ for
this, that would be fine with me. All I'm asking for is
*some* way to write things like this without having to
repeat the name of the thing being defined. There doesn't
seem to be any way to do that at the moment without
abusing some other construct, such as using a 'def'
when you aren't really defining a function.


More information about the Python-ideas mailing list