[Python-Dev] terminology for "free variables" in Python

Eli Bendersky eliben at gmail.com
Fri Sep 10 09:06:04 CEST 2010


> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100910/f1091e85/attachment.html>


More information about the Python-Dev mailing list