Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

Jacob Kruger jacob.kruger.work at gmail.com
Wed Mar 6 11:50:31 EST 2024


You'll see more details in other mail, but, here I am firing up standard 
python interpreter from within windows terminal, and then executing 
following line:

from scoping2 import *


And, this is under windows 11 windows terminal, which is where I 
generally interact with my python code, via command line - generally 
working with flask, and/or other forms of command line interaction, most 
of the time.


Jacob Kruger
+2782 413 4791
"Resistance is futile!...Acceptance is versatile..."


On 2024/03/06 17:39, Roel Schroeven via Python-list wrote:
> Op 6/03/2024 om 13:55 schreef Jacob Kruger via Python-list:
>> If you import the contents of that file into the python interpreter, 
>> [...]
>
> What exactly to you mean by "import the contents of that file into the 
> python interpreter"? Other people have put your code in a script, 
> executed it, and saw it working as expected. I pasted in IPython, and 
> likewise saw it working as expected, and the same with IDLE. It seems 
> to me you must be doing something different from us; maybe the way you 
> execute that code might be the key to this whole confusion.
>


More information about the Python-list mailing list