João Sebastião de Oliveira Bueno <gwid...@gmail.com> added the comment:

This discussion is fresh, so maybe it is worth asking here prior to 
python-ideas:

In Python we can change any global variable, object attribute or mapping-value 
with function calls. Locals and nonlocals are the only exceptions and from time 
to time that gets in the way of clever oneliners, and it is just plain 
asymmetric. 

What do you say of adding a wrapper to this as an oficial Python function in 
the stdlib? Maybe inspect.setlocal() that could set f_locals and call this?? 
That would  provide a workaround to the asymmetry that locals currently 
experiment. 

It would not impose any extra security risks, since this can be called via 
ctypes already, and also it is not any more subject to abuse than setattr or 
globals()[...] =  can already be abused.

----------
nosy: +João.Sebastião.de.Oliveira.Bueno

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue19431>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to