by ssanderson11235 · 11y ago · 0 comments
As an example, I've got a PR open right now that lets you do things like:
@mutable_locals
def f():
out = []
x = 1
out.append(x)
locals().update({'x': 2, 'y': 3})
out.append(x)
out.append(y)
return out
assert f() == [1, 2, 3]
which works using a combination of ctypes hackery and replacing all LOAD_FAST instructions with appropriately-resolved LOAD_NAME instructions.No comments yet.