[Python-ideas] local variable access : __getlocal__ and __setlocal__

Tal Einat taleinat at gmail.com
Sun Feb 18 22:31:06 CET 2007

On 2/18/07, Pierre-Yves Martin <pym.aldebaran at gmail.com> wrote:
> Currently it's possible to customize attribute access via methods :
> __getattribute__(self, name)
> __getattr__(self, name)
> __setattr__(self, name, value)
> but it is not possible to customize local variable access. It would be
> useful for example to allow implementation of a local constant or any other
> on-access/on-modification behavior. The function should could be:
> __getlocal__(name)
> __setlocal__(name, value)


IMO this would allow changing the basic behavior of Python too much.
Variable assignment should be variable assignment.

I am generally wary of such behind-the-scenes magic, since it can easily be
taken too far, resulting in highly unreadable code -- not very Pythonic.

- Tal Einat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20070218/a65cc773/attachment.html>

More information about the Python-ideas mailing list