diff --git a/Doc/library/runpy.rst b/Doc/library/runpy.rst --- a/Doc/library/runpy.rst +++ b/Doc/library/runpy.rst @@ -69,6 +69,9 @@ The :mod:`runpy` module provides two fun arguments. It is recommended that the :mod:`sys` module be left alone when invoking this function from threaded code. + .. seealso:: + The :option:`-m` option offering equivalent functionality from the command + line .. versionchanged:: 3.1 Added ability to execute packages by looking for a ``__main__`` submodule. @@ -130,14 +133,18 @@ The :mod:`runpy` module provides two fun limitations still apply, use of this function in threaded code should be either serialised with the import lock or delegated to a separate process. + .. seealso:: + :ref:`using-on-interface-options` for equivalent functionality on the command + line (``python path/to/script``). + .. versionadded:: 3.2 .. seealso:: - :pep:`338` - Executing modules as scripts + :pep:`338` -- Executing modules as scripts PEP written and implemented by Nick Coghlan. - :pep:`366` - Main module explicit relative imports + :pep:`366` -- Main module explicit relative imports PEP written and implemented by Nick Coghlan. - :ref:`using-on-general` - CPython command line details + :ref:`using-on-general` -- CPython command line details diff --git a/Doc/tutorial/interpreter.rst b/Doc/tutorial/interpreter.rst --- a/Doc/tutorial/interpreter.rst +++ b/Doc/tutorial/interpreter.rst @@ -63,6 +63,8 @@ and enter interactive mode afterwards. before the script. (This does not work if the script is read from standard input, for the same reason as explained in the previous paragraph.) +All command-line options are described in :ref:`using-on-general`. + .. _tut-argpassing: @@ -243,7 +245,7 @@ The Customization Modules Python provides two hooks to let you customize it: :mod:`sitecustomize` and :mod:`usercustomize`. To see how it works, you need first to find the location -of your user site-packages directory. Start Python and run this code: +of your user site-packages directory. Start Python and run this code:: >>> import site >>> site.getusersitepackages() diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -1,7 +1,7 @@ -.. highlightlang:: none +.. highlightlang:: sh .. ATTENTION: You probably should update Misc/python.man, too, if you modify -.. this file. + this file. .. _using-on-general: @@ -144,6 +144,10 @@ source. added to the start of :data:`sys.path` and the ``__main__.py`` file in that location is executed as the :mod:`__main__` module. + .. seealso:: + :func:`runpy.run_path` + Equivalent functionality directly available to Python code + If no interface option is given, :option:`-i` is implied, ``sys.argv[0]`` is an empty string (``""``) and the current directory will be added to the @@ -265,7 +269,9 @@ Miscellaneous options Warning control. Python's warning machinery by default prints warning messages to :data:`sys.stderr`. A typical warning message has the following - form:: + form: + + .. code-block:: none file:line: category: message