Skip to content

Instantly share code, notes, and snippets.

@amjith
Created June 13, 2015 17:25
Show Gist options
  • Save amjith/5c5ffdbf06fecf9e4897 to your computer and use it in GitHub Desktop.
Save amjith/5c5ffdbf06fecf9e4897 to your computer and use it in GitHub Desktop.
from contextlib import contextmanager
import sys
@contextmanager
def export():
print "Enter:"
yield
print sys._getframe(2).f_locals
print "Exit"
class Foo(object):
def set_foo(self, val):
self.val = val
with export():
bar = Foo()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment