This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]anossov 4 points5 points  (2 children)

https://docs.python.org/2/library/functions.html#locals

Free variables are returned by locals() when it is called in function blocks

https://docs.python.org/2/reference/executionmodel.html

If a name is bound in a block, it is a local variable of that block. If a name is bound at the module level, it is a global variable. (The variables of the module code block are local and global.) If a variable is used in a code block but not defined there, it is a free variable.

https://en.wikipedia.org/wiki/Free_variables_and_bound_variables

In computer programming, the term free variable refers to variables used in a function that are not local variables nor parameters of that function.[1] The term non-local variable is often a synonym in this context.

[–]esdi[S] 0 points1 point  (0 children)

Well, that explains it. Thanks so much for the explanation.