[Python-ideas] Decorators for variables

Matthias welp boekewurm at gmail.com
Fri Apr 1 14:08:54 EDT 2016


> Function decorators

There are decorators that return a callable that not calls the function
that was given as an argument, but also do some other things, and therefore
change the behaviour of that function.

> 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
)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160401/59177bd6/attachment.html>


More information about the Python-ideas mailing list