public
Last active

python clear hack

  • Download Gist
clearhack.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# saran = clear wrap. get it?
def saran(f):
def g(*args, **kwargs):
d = f(*args, **kwargs)
try:
_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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.