Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
python clear hack
# saran = clear wrap. get it?
def saran(f):
def g(*args, **kwargs):
d = f(*args, **kwargs)
_clear = d.pop('clear')
except KeyError:
return d
d['clear'] = _clear
return d
return g
vars = saran(vars)
locals = saran(locals)
globals = saran(globals)
del saran
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment