Dear Sirs.

I found the following sentence in the Python documentation: "The statements 
executed by the top-level invocation of the interpreter, either read from a 
script file or interactively, are considered part of a module called 
__main__<https://docs.python.org/3.11/library/__main__.html#module-__main__>, 
so they have their own global namespace."

In other words, global assignments of variables placed directly in a module's 
name space are also "statements executed by the top-level invocation of the 
interpreter", if the module is executed as a script.

Is it stable at all to assign global variables directly in a module which runs 
as a script? Speaking practically, I have not observed any problem so far.

Regards,
Dmitry Popov

-- 
https://mail.python.org/mailman3//lists/python-list.python.org

Reply via email to