Newcomer question wrt variable scope/namespaces

Florian Daniel Otel florian.otel at gmail.com
Fri Jan 13 17:38:44 EST 2006


Gary,

First of all, many  thanks for the reply. Do I understand it correctly
that actually the rule has to be refined as pertaining  to the (so
called) "immutable" types (like e.g.  integers, tuples/strings)
whereas lists and dictionaries are "mutable" types and the said
scoping rule does not apply ?

Thanks again,

Florian

On 1/13/06, Gary Duzan <gary.duzan at motorola.com> wrote:
>
>     Right. However, assigning to a['foo'] modifies the object to which
> 'a' refers, not the 'a' variable itself. The rule is limited to the
> rebinding of variables, not the modification of the objects to which
> they refer.
>
>                                         Gary Duzan
>                                         Motorola CHS
>
>



More information about the Python-list mailing list