Created
August 26, 2010 22:59
-
-
Save hoffmann/552419 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def debug(s, *args, **kwargs): | |
c_frame = inspect.getouterframes(inspect.currentframe(), 1)[1][0] | |
c_args, c_varargs, c_varkw, c_locals = inspect.getargvalues(c_frame) | |
d = dict(c_locals) | |
if kwargs: d.update(kwargs) | |
print s.format(*args, **d) | |
def foo(): | |
bar = 'world' | |
debug('hello {bar}') | |
foo() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment