[issue39452] Improve the __main__ module documentation

Géry report at bugs.python.org
Thu Sep 17 05:43:10 EDT 2020


Géry <gery.ogam at gmail.com> added the comment:

I agree with you Terry. Another thing that bothers me: in the current document, the __main__ module is reduced to its environment (aka context or dictionary), whereas a module object has other important attributes such as its code.

So how about adding the following changes?

- :mod:`__main__` --- Top-level code environment
- ==============================================
+ :mod:`__main__` --- Startup module
+ ==================================

-    :synopsis: The environment where top-level code is run.
+    :synopsis: The first module from which the code is executed at startup.

- ``'__main__'`` is the name of the environment where top-level code is run.
+ ``'__main__'`` is the name of the startup module.

- A module can discover whether or not it is running in the main environment
+ A module can discover whether or not it is initialized as the :mod:`__main__` module

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39452>
_______________________________________


More information about the Python-bugs-list mailing list