(original) (raw)


There's a slight inconsistency. The names a code object explicitly

calls out as free variables (i.e. references to cells in outer scopes)

are only a subset of the full set of free variables (every referenced

name that isn't a local variable or an attribute).



>>> from dis import show_code

>>> def outer():

... � x, y = 1, 2

... � def inner():

... � � print (x, y, a, b, c.e)

... � return inner

...

>>> f = outer()

>>> show_code(f)


Nick, did you know that dis.show_code is neither exported by default from the dis module, nor it's documented in its help() or .rst documentation? Neither is code_info(), which is used by show_code(). I wonder if this is intentional.


Eli