The Voidspace Techie Blog

Gravatar I am glad this write-up exists. In a few years, when I am smart enough to understand it, it will be available by web search.

(A few years... I am being optimistic...)


Gravatar Hello Manuel,

The key to understanding it is understanding the Python scoping rules. A new function (or method) creates a new scope. This scope contains the local variables for the function - and is implemented as a stack frame object, with the associated code object.

In Python 2.4, generator expressions also create a new scope.

Michael


Name:

Email:

URL:

Comment:  ? 

 

Commenting by HaloScan