[Python-ideas] Decorators for variables

Matthias welp boekewurm at gmail.com
Sun Apr 3 04:02:55 EDT 2016


> So is there anything left of the assignment-decorator proposal, or is
> it completely withdrawn?

I think this sums the current open ends up:

- Namespace variables decoration was dismissed by one of Steven's posts,
but is actually something that might be wanted (via being able to put
descriptors into namespaces that have a __dict__ accessor (e.g. modules))
- Variable decoration can be more clear about descriptor/value difference
at assignment
- Giving property objects access to their variable's name (e.g. via
__name__) like functions have would open up quite a bit of possibilities,
and would mean decorators would get quite a bit more power than what they
have.

Something that I had said earlier, but what went on a sidepath
- Decorators may directly *deep* set the behaviour of the variable, and
with it set the further behaviour of the variable (in the same scope). Such
that

    @decorator
    var = 20

    var = 40

    will not reset var to 40, but the var = 40 goes through the descriptor
(if applied).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160403/6b9a21ab/attachment.html>


More information about the Python-ideas mailing list