[Python-Dev] Explicit Lexical Scoping (pre-PEP?) (original) (raw)

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Jul 6 02:33:39 CEST 2006


skip at pobox.com wrote:

By naming the function in which the binding is to occur you avoid problems of someone coming along and adding or deleting functions between the assignment (in baz) and the target of the assignment (x in foo) but then forgetting to increment or decrement the counters that refer to a fixed number of levels above the current function.

But it doesn't do anything for the (I expect much more common) case of factoring out something in a function body and making it a nested function -- you'd still have to change the form of all the references to the name in that case.

Better not to have a scheme that uses counters or scope names at all, I think.

-- Greg



More information about the Python-Dev mailing list