Skip to content

Instantly share code, notes, and snippets.

@jml
Created August 13, 2014 18:57
Show Gist options
  • Select an option

  • Save jml/09eeb640d417beaf854f to your computer and use it in GitHub Desktop.

Select an option

Save jml/09eeb640d417beaf854f to your computer and use it in GitHub Desktop.
$ python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def f(x):
... return x + a
...
>>> f.func_code.co_names
('a',)
>>> f.func_code.co_varnames
('x',)
>>> def g(x):
... y = x + 2
... z = y + a
... return z
...
>>> g.func_code.co_names
('a',)
>>> g.func_code.co_varnames
('x', 'y', 'z')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment