please help explain this result

Yingjie Lan lanyjie at
Sun Oct 17 14:53:39 CEST 2010

--- On Sun, 10/17/10, Steven D'Aprano <steve at> wrote:

> (1) If you assign to a variable *anywhere* in the function,
> it is a local 
> *everywhere* in the function.
> There is no way to have a variable refer to a local in some
> places of a 
> function and a global in other places of the same function.
> This is by 
> design.

Super crystal clear. Thanks a lot!



More information about the Python-list mailing list