This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jsbueno
Recipients cheryl.sabella, docs@python, georg.brandl, jsbueno, pitrou, serhiy.storchaka, vstinner
Date 2018-01-12.14:09:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1515766188.99.0.467229070634.issue19431@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-01-12 14:09:49jsbuenosetrecipients: + jsbueno, georg.brandl, pitrou, vstinner, docs@python, serhiy.storchaka, cheryl.sabella
2018-01-12 14:09:48jsbuenosetmessageid: <1515766188.99.0.467229070634.issue19431@psf.upfronthosting.co.za>
2018-01-12 14:09:48jsbuenolinkissue19431 messages
2018-01-12 14:09:48jsbuenocreate