Nested function scope problem

Gerhard Fiedler gelists at gmail.com
Mon Jul 24 16:35:50 EDT 2006


On 2006-07-24 17:09:24, Steve Holden wrote:

> Would I do? 

It seems so :)

> If there's a binding to a name *anywhere* in the function's body then
> that name is treated as local to the function. 
> 
> This is a matter of static analysis, and is irrespective of where in the
> body the assignment is found. 

One difficulty I'm having is knowing the proper terminology when looking
for an effect like this. Just someone rephrasing the question using the
proper terms already helps a lot. "Binding" seems to be the keyword here.

It is surprising in the sense that binding seems not to be necessary for
read access. 


Going back to the original question... What would be the most common/useful
way to access variables from the outer function for writing from within the
inner function?

Thanks,
Gerhard




More information about the Python-list mailing list