diff options
author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-01-11 10:05:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-11 10:05:41 (GMT) |
commit | 847d7708ba8739a5d5d31f22d71497527a7d8241 (patch) | |
tree | 58d716731eaf7ff9b9e5bd806d1c8a2b26157ff9 /Doc/library | |
parent | 8795ad1bd0d6ee031543fcaf5a86a60b37950714 (diff) | |
download | cpython-847d7708ba8739a5d5d31f22d71497527a7d8241.zip cpython-847d7708ba8739a5d5d31f22d71497527a7d8241.tar.gz cpython-847d7708ba8739a5d5d31f22d71497527a7d8241.tar.bz2 |
gh-98763: Prefer "python" over "python3" for command line examples in docs. (#98761)
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/__main__.rst | 16 | ||||
-rw-r--r-- | Doc/library/devmode.rst | 12 | ||||
-rw-r--r-- | Doc/library/faulthandler.rst | 4 | ||||
-rw-r--r-- | Doc/library/site.rst | 4 | ||||
-rw-r--r-- | Doc/library/timeit.rst | 6 |
5 files changed, 21 insertions, 21 deletions
diff --git a/Doc/library/__main__.rst b/Doc/library/__main__.rst index d0a65e7..6a2a7a7 100644 --- a/Doc/library/__main__.rst +++ b/Doc/library/__main__.rst @@ -61,7 +61,7 @@ The top-level code environment can be: .. code-block:: shell-session - $ python3 helloworld.py + $ python helloworld.py Hello, world! * the Python module or package passed to the Python interpreter with the @@ -69,14 +69,14 @@ The top-level code environment can be: .. code-block:: shell-session - $ python3 -m tarfile + $ python -m tarfile usage: tarfile.py [-h] [-v] (...) * Python code read by the Python interpreter from standard input: .. code-block:: shell-session - $ echo "import this" | python3 + $ echo "import this" | python The Zen of Python, by Tim Peters Beautiful is better than ugly. @@ -87,7 +87,7 @@ The top-level code environment can be: .. code-block:: shell-session - $ python3 -c "import this" + $ python -c "import this" The Zen of Python, by Tim Peters Beautiful is better than ugly. @@ -178,7 +178,7 @@ that your function will return some value acceptable as an input to returned if your function does not have a return statement). By proactively following this convention ourselves, our module will have the -same behavior when run directly (i.e. ``python3 echo.py``) as it will have if +same behavior when run directly (i.e. ``python echo.py``) as it will have if we later package it as a console script entry-point in a pip-installable package. @@ -215,7 +215,7 @@ directly from the command line using the :option:`-m` flag. For example: .. code-block:: shell-session - $ python3 -m bandclass + $ python -m bandclass This command will cause ``__main__.py`` to run. How you utilize this mechanism will depend on the nature of the package you are writing, but in this @@ -320,7 +320,7 @@ Now, if we started our program, the result would look like this: .. code-block:: shell-session - $ python3 start.py + $ python start.py Define the variable `my_name`! The exit code of the program would be 1, indicating an error. Uncommenting the @@ -329,7 +329,7 @@ status code 0, indicating success: .. code-block:: shell-session - $ python3 start.py + $ python start.py Dinsdale found in file /path/to/start.py Note that importing ``__main__`` doesn't cause any issues with unintentionally diff --git a/Doc/library/devmode.rst b/Doc/library/devmode.rst index 44e7d4f..9777359 100644 --- a/Doc/library/devmode.rst +++ b/Doc/library/devmode.rst @@ -21,7 +21,7 @@ Effects of the Python Development Mode Enabling the Python Development Mode is similar to the following command, but with additional effects described below:: - PYTHONMALLOC=debug PYTHONASYNCIODEBUG=1 python3 -W default -X faulthandler + PYTHONMALLOC=debug PYTHONASYNCIODEBUG=1 python -W default -X faulthandler Effects of the Python Development Mode: @@ -128,14 +128,14 @@ any warning. Example using README.txt, which has 269 lines: .. code-block:: shell-session - $ python3 script.py README.txt + $ python script.py README.txt 269 Enabling the Python Development Mode displays a :exc:`ResourceWarning` warning: .. code-block:: shell-session - $ python3 -X dev script.py README.txt + $ python -X dev script.py README.txt 269 script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper name='README.rst' mode='r' encoding='UTF-8'> main() @@ -146,7 +146,7 @@ opened: .. code-block:: shell-session - $ python3 -X dev -X tracemalloc=5 script.py README.rst + $ python -X dev -X tracemalloc=5 script.py README.rst 269 script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper name='README.rst' mode='r' encoding='UTF-8'> main() @@ -190,7 +190,7 @@ By default, Python does not emit any warning: .. code-block:: shell-session - $ python3 script.py + $ python script.py import os The Python Development Mode shows a :exc:`ResourceWarning` and logs a "Bad file @@ -198,7 +198,7 @@ descriptor" error when finalizing the file object: .. code-block:: shell-session - $ python3 script.py + $ python script.py import os script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper name='script.py' mode='r' encoding='UTF-8'> main() diff --git a/Doc/library/faulthandler.rst b/Doc/library/faulthandler.rst index be09123..07a7489 100644 --- a/Doc/library/faulthandler.rst +++ b/Doc/library/faulthandler.rst @@ -166,10 +166,10 @@ handler: .. code-block:: shell-session - $ python3 -c "import ctypes; ctypes.string_at(0)" + $ python -c "import ctypes; ctypes.string_at(0)" Segmentation fault - $ python3 -q -X faulthandler + $ python -q -X faulthandler >>> import ctypes >>> ctypes.string_at(0) Fatal Python error: Segmentation fault diff --git a/Doc/library/site.rst b/Doc/library/site.rst index 5941739..4a88013 100644 --- a/Doc/library/site.rst +++ b/Doc/library/site.rst @@ -250,8 +250,8 @@ command line: .. code-block:: shell-session - $ python3 -m site --user-site - /home/user/.local/lib/python3.3/site-packages + $ python -m site --user-site + /home/user/.local/lib/python3.11/site-packages If it is called without arguments, it will print the contents of :data:`sys.path` on the standard output, followed by the value of diff --git a/Doc/library/timeit.rst b/Doc/library/timeit.rst index 660a546..5437704 100644 --- a/Doc/library/timeit.rst +++ b/Doc/library/timeit.rst @@ -27,11 +27,11 @@ can be used to compare three different expressions: .. code-block:: shell-session - $ python3 -m timeit '"-".join(str(n) for n in range(100))' + $ python -m timeit '"-".join(str(n) for n in range(100))' 10000 loops, best of 5: 30.2 usec per loop - $ python3 -m timeit '"-".join([str(n) for n in range(100)])' + $ python -m timeit '"-".join([str(n) for n in range(100)])' 10000 loops, best of 5: 27.5 usec per loop - $ python3 -m timeit '"-".join(map(str, range(100)))' + $ python -m timeit '"-".join(map(str, range(100)))' 10000 loops, best of 5: 23.2 usec per loop This can be achieved from the :ref:`python-interface` with:: |