How can I modify the local namespace of a function in python? I know that locals() returns the local namespace of the function when called inside it, but I want to do somet
This seems to work
def add_to_locals(l): l['newlocal'] = 1 add_to_locals(locals()) assert newlocal