Skip to content

Instantly share code, notes, and snippets.

@daeken
Created August 28, 2012 06:13
Show Gist options
  • Save daeken/3495409 to your computer and use it in GitHub Desktop.
Save daeken/3495409 to your computer and use it in GitHub Desktop.
state decorator
import inspect
def stater(func):
def sub(*args, **kwargs):
frame = inspect.stack()[1][0]
return func(frame.f_locals, frame.f_globals, *args, **kwargs)
return sub
@stater
def explode(_locals, _globals, hash):
_locals.update(hash)
explode(dict(foo='bar', baz='hax'))
print foo, baz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment