mirror of
https://github.com/python/cpython.git
synced 2025-07-30 14:44:10 +00:00
Issue #21920: Merge from 3.4.
This commit is contained in:
commit
e8b59dac12
1 changed files with 1 additions and 1 deletions
|
@ -12,7 +12,7 @@ standard input, a script, or from an interactive prompt.
|
||||||
A module can discover whether or not it is running in the main scope by
|
A module can discover whether or not it is running in the main scope by
|
||||||
checking its own ``__name__``, which allows a common idiom for conditionally
|
checking its own ``__name__``, which allows a common idiom for conditionally
|
||||||
executing code in a module when it is run as a script or with ``python
|
executing code in a module when it is run as a script or with ``python
|
||||||
-m`` but not when it is imported:
|
-m`` but not when it is imported::
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# execute only if run as a script
|
# execute only if run as a script
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue