[Python-ideas] Decorators for variables

Ethan Furman ethan at stoneleaf.us
Fri Apr 1 14:33:03 EDT 2016

On 04/01/2016 11:08 AM, Matthias welp wrote:
 > Even earlier, Ethan Furman wrote:

>> So instead of
>>   a = Char(length=10, value='empty')
>> you want
>>   @Char(length=10)
>>   a = 'empty'
>> ?
> If possible, yes. So that there is a standardized way to access changing
> variables, or to put limits on the content of the variable, similar to
> the @accepts and @produces decorators that are seen here
> (https://wiki.python.org/moin/PythonDecoratorLibrary#Type_Enforcement_.28accepts.2Freturns.29)

I don't see it happening.  Making that change would be a lot of work, 
and the advantages (if any) of the second method over the first do not 
warrant it.


More information about the Python-ideas mailing list