diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2009-02-08 01:58:26 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2009-02-08 01:58:26 (GMT) |
commit | 3f48ae35c710c5e5101d5de6721b1e2ccb56df68 (patch) | |
tree | 971feab37df37b7ab70429c75069d36b2c8b9557 /Doc/using | |
parent | f72d9fb02f2ff536c64f1e65780b4a414eb3bb4d (diff) | |
download | cpython-3f48ae35c710c5e5101d5de6721b1e2ccb56df68.zip cpython-3f48ae35c710c5e5101d5de6721b1e2ccb56df68.tar.gz cpython-3f48ae35c710c5e5101d5de6721b1e2ccb56df68.tar.bz2 |
Merged revisions 69419-69420 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r69419 | nick.coghlan | 2009-02-08 11:26:34 +1000 (Sun, 08 Feb 2009) | 1 line
Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
........
r69420 | nick.coghlan | 2009-02-08 11:46:01 +1000 (Sun, 08 Feb 2009) | 1 line
Mention patch submitter in NEWS entry for r69419
........
Diffstat (limited to 'Doc/using')
-rw-r--r-- | Doc/using/cmdline.rst | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index 3481d5b..9eecba6 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -78,6 +78,12 @@ source. the implementation may not always enforce this (e.g. it may allow you to use a name that includes a hyphen). + Package names are also permitted. When a package name is supplied instead + of a normal module, the interpreter will execute ``<pkg>.__main__`` as + the main module. This behaviour is deliberately similar to the handling + of directories and zipfiles that are passed to the interpreter as the + script argument. + .. note:: This option cannot be used with builtin modules and extension modules @@ -97,11 +103,14 @@ source. .. seealso:: :func:`runpy.run_module` - The actual implementation of this feature. + Equivalent functionality directly available to Python code :pep:`338` -- Executing modules as scripts + .. versionchanged:: 3.1 + Supply the package name to run a ``__main__`` submodule. + .. describe:: - Read commands from standard input (:data:`sys.stdin`). If standard input is |