Re: Newcomer question wrt variable scope/namespaces

2006-01-18 Thread Florian Daniel Otel
Mike, Gary, Magnus First of all, thanks to you all for the clarifications. On 1/14/06, Mike Meyer <[EMAIL PROTECTED]> wrote: > Python variables are just names. They refer to (are "bound" to) > objects. An assignment statement doesn't change a value. It rebinds > the variable (or lvalue) to the va

Re: Newcomer question wrt variable scope/namespaces

2006-01-18 Thread Magnus Lycka
Florian Daniel Otel wrote: > 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 ? No! The

Re: Newcomer question wrt variable scope/namespaces

2006-01-17 Thread Gary Duzan
Florian Daniel Otel wrote: > 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

Re: Newcomer question wrt variable scope/namespaces

2006-01-14 Thread Diez B. Roggisch
Florian Daniel Otel wrote: > 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

Re: Newcomer question wrt variable scope/namespaces

2006-01-13 Thread Florian Daniel Otel
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 appl

Re: Newcomer question wrt variable scope/namespaces

2006-01-13 Thread Gary Duzan
Florian Daniel Otel wrote: > > My problem: I just discovered (by mistake) that attempting to assign a > value to a non-local dictionary/list member does NOT generate an " > UnboundLocalError" exception and the assignment is preserved upon > exiting that scope (i.e. function). This would "violate"

Newcomer question wrt variable scope/namespaces

2006-01-13 Thread Florian Daniel Otel
Hello all, As the subject says, I am a newcomer to Python and I have a newcomer question wrt namespaces and variable scope. Obviously, I might be missing smth obvious, so TIA for the patience and/or pointers to relevant resources My problem: I just discovered (by mistake) that attempting to assig

Re: Newcomer question wrt variable scope/namespaces

2006-01-13 Thread gene tani
Florian Daniel Otel wrote: > Hello all, > > > Attached are 3 small python scripts that illustrate my "problem". The > first one uses string tuples and behaves as expected. The other two > use dictionaries and (resp.) lists and illustrate my "problem" > > TIA for any pointers, > > Florian > > P.S.