Scope, type and UnboundLocalError

Paddy paddy3118 at netscape.net
Sun Jul 9 14:35:14 EDT 2006


Paddy wrote:

>
> So,
> An assignment statement may assign an object to a name, in which case
> the name is 'tagged' as being local,
> An assignment statement may mutate a mutable object already bound to a
> name, in which case the assignment will not 'tag' the name as  being
> local.
>
> I guess Bruno, you mean irrelevant as in 'although only mutable objects
> can have their state modified; if n has a mutable value but the
> assignment statement changed the object referred to by n, then the name
> would be tagged as local'?
>
> - Peace,  Paddy.

No, that last paragraph still does not convey what I meant.


... irrelevant as in 'although only mutable objects can have their
state modified; if n has a mutable value but the assignment statement
changed n to refer to another object, then the name would be tagged as
local'?

Oh bosh, can anyone come at it from a different tack?

Ta.




More information about the Python-list mailing list