[Python-ideas] Decorators for variables

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Apr 1 20:27:48 EDT 2016


Chris Angelico wrote:
> var = some_value
> var = decorator(var)
> 
> with this:
> 
> var = decorator(some_value)
> 
> as in your example. Decorator syntax buys us nothing above this.

It would if it made the name of the variable available
to the decorator:

@decorator
var = value

becomes

var = decorator("var", value)

-- 
Greg



More information about the Python-ideas mailing list