
May 27, 2016
3:15 a.m.
On Fri, May 27, 2016 at 1:05 PM, Ethan Furman <ethan@stoneleaf.us> wrote:
On 05/26/2016 07:57 PM, Chris Angelico wrote:
On Fri, May 27, 2016 at 12:43 PM, Rob Cliffe wrote:
How about
locals().update(values)
Because locals() can't be updated unless it happens to be the same dict as globals(), in which case it's clearer to use that name.
Actually, the dict returned by locals() can be updated, but at least in cPython those updates don't make it back to the function's locals (although they do in other Python's).
Sorry, yeah. The dict is a dict, so of course it can be updated, but the changes aren't guaranteed to have effect. Point is, it's not a suitable way to do this. :) ChrisA