[Python-ideas] wild idea : target decorators

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Sep 25 11:57:00 CEST 2009

Guido van Rossum wrote:

> So, you don't care abut the repetition of x in "x = f(x)" but you'd
> like to have a way to implicitly pass an argument giving the string
> name of the target variable, like "x = f('x')" ?

Yes. I'm defining a property, and the descriptor happens
to need to know the name of the property being defined,
but that's an implementation detail. The user shouldn't
be required, or even allowed, to specify it as an
independent parameter.

 > I'm not sure that it's common enough to warrant special
> syntax;

Probably not very common in general, but I find myself
doing this very intensively in some of my projects. I
have two GUI libraries in which nearly every externally
visible attribute is one of these properties.


More information about the Python-ideas mailing list