| 1 |
|
| 2 |
:mod:`__main__` --- Top-level script environment |
| 3 |
================================================ |
| 4 |
|
| 5 |
.. module:: __main__ |
| 6 |
:synopsis: The environment where the top-level script is run. |
| 7 |
|
| 8 |
|
| 9 |
This module represents the (otherwise anonymous) scope in which the |
| 10 |
interpreter's main program executes --- commands read either from standard |
| 11 |
input, from a script file, or from an interactive prompt. It is this |
| 12 |
environment in which the idiomatic "conditional script" stanza causes a script |
| 13 |
to run:: |
| 14 |
|
| 15 |
if __name__ == "__main__": |
| 16 |
main() |
| 17 |
|