Skip to content

Commit 9ef0759

Browse files
committed
Prefer "python" over "python3" in docs.
See https://peps.python.org/pep-0394/#for-end-users-of-python
1 parent e60892f commit 9ef0759

File tree

8 files changed

+77
-77
lines changed

8 files changed

+77
-77
lines changed

Doc/howto/argparse.rst

+54-54
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@ Following is a result of running the code:
7979

8080
.. code-block:: shell-session
8181
82-
$ python3 prog.py
83-
$ python3 prog.py --help
82+
$ python prog.py
83+
$ python prog.py --help
8484
usage: prog.py [-h]
8585
8686
options:
8787
-h, --help show this help message and exit
88-
$ python3 prog.py --verbose
88+
$ python prog.py --verbose
8989
usage: prog.py [-h]
9090
prog.py: error: unrecognized arguments: --verbose
91-
$ python3 prog.py foo
91+
$ python prog.py foo
9292
usage: prog.py [-h]
9393
prog.py: error: unrecognized arguments: foo
9494
@@ -121,18 +121,18 @@ And running the code:
121121

122122
.. code-block:: shell-session
123123
124-
$ python3 prog.py
124+
$ python prog.py
125125
usage: prog.py [-h] echo
126126
prog.py: error: the following arguments are required: echo
127-
$ python3 prog.py --help
127+
$ python prog.py --help
128128
usage: prog.py [-h] echo
129129
130130
positional arguments:
131131
echo
132132
133133
options:
134134
-h, --help show this help message and exit
135-
$ python3 prog.py foo
135+
$ python prog.py foo
136136
foo
137137
138138
Here is what's happening:
@@ -166,7 +166,7 @@ And we get:
166166

167167
.. code-block:: shell-session
168168
169-
$ python3 prog.py -h
169+
$ python prog.py -h
170170
usage: prog.py [-h] echo
171171
172172
positional arguments:
@@ -187,7 +187,7 @@ Following is a result of running the code:
187187

188188
.. code-block:: shell-session
189189
190-
$ python3 prog.py 4
190+
$ python prog.py 4
191191
Traceback (most recent call last):
192192
File "prog.py", line 5, in <module>
193193
print(args.square**2)
@@ -208,9 +208,9 @@ Following is a result of running the code:
208208

209209
.. code-block:: shell-session
210210
211-
$ python3 prog.py 4
211+
$ python prog.py 4
212212
16
213-
$ python3 prog.py four
213+
$ python prog.py four
214214
usage: prog.py [-h] square
215215
prog.py: error: argument square: invalid int value: 'four'
216216
@@ -235,17 +235,17 @@ And the output:
235235

236236
.. code-block:: shell-session
237237
238-
$ python3 prog.py --verbosity 1
238+
$ python prog.py --verbosity 1
239239
verbosity turned on
240-
$ python3 prog.py
241-
$ python3 prog.py --help
240+
$ python prog.py
241+
$ python prog.py --help
242242
usage: prog.py [-h] [--verbosity VERBOSITY]
243243
244244
options:
245245
-h, --help show this help message and exit
246246
--verbosity VERBOSITY
247247
increase output verbosity
248-
$ python3 prog.py --verbosity
248+
$ python prog.py --verbosity
249249
usage: prog.py [-h] [--verbosity VERBOSITY]
250250
prog.py: error: argument --verbosity: expected one argument
251251
@@ -281,12 +281,12 @@ And the output:
281281

282282
.. code-block:: shell-session
283283
284-
$ python3 prog.py --verbose
284+
$ python prog.py --verbose
285285
verbosity turned on
286-
$ python3 prog.py --verbose 1
286+
$ python prog.py --verbose 1
287287
usage: prog.py [-h] [--verbose]
288288
prog.py: error: unrecognized arguments: 1
289-
$ python3 prog.py --help
289+
$ python prog.py --help
290290
usage: prog.py [-h] [--verbose]
291291
292292
options:
@@ -327,9 +327,9 @@ And here goes:
327327

328328
.. code-block:: shell-session
329329
330-
$ python3 prog.py -v
330+
$ python prog.py -v
331331
verbosity turned on
332-
$ python3 prog.py --help
332+
$ python prog.py --help
333333
usage: prog.py [-h] [-v]
334334
335335
options:
@@ -361,14 +361,14 @@ And now the output:
361361

362362
.. code-block:: shell-session
363363
364-
$ python3 prog.py
364+
$ python prog.py
365365
usage: prog.py [-h] [-v] square
366366
prog.py: error: the following arguments are required: square
367-
$ python3 prog.py 4
367+
$ python prog.py 4
368368
16
369-
$ python3 prog.py 4 --verbose
369+
$ python prog.py 4 --verbose
370370
the square of 4 equals 16
371-
$ python3 prog.py --verbose 4
371+
$ python prog.py --verbose 4
372372
the square of 4 equals 16
373373
374374
* We've brought back a positional argument, hence the complaint.
@@ -397,16 +397,16 @@ And the output:
397397

398398
.. code-block:: shell-session
399399
400-
$ python3 prog.py 4
400+
$ python prog.py 4
401401
16
402-
$ python3 prog.py 4 -v
402+
$ python prog.py 4 -v
403403
usage: prog.py [-h] [-v VERBOSITY] square
404404
prog.py: error: argument -v/--verbosity: expected one argument
405-
$ python3 prog.py 4 -v 1
405+
$ python prog.py 4 -v 1
406406
4^2 == 16
407-
$ python3 prog.py 4 -v 2
407+
$ python prog.py 4 -v 2
408408
the square of 4 equals 16
409-
$ python3 prog.py 4 -v 3
409+
$ python prog.py 4 -v 3
410410
16
411411
412412
These all look good except the last one, which exposes a bug in our program.
@@ -431,10 +431,10 @@ And the output:
431431

432432
.. code-block:: shell-session
433433
434-
$ python3 prog.py 4 -v 3
434+
$ python prog.py 4 -v 3
435435
usage: prog.py [-h] [-v {0,1,2}] square
436436
prog.py: error: argument -v/--verbosity: invalid choice: 3 (choose from 0, 1, 2)
437-
$ python3 prog.py 4 -h
437+
$ python prog.py 4 -h
438438
usage: prog.py [-h] [-v {0,1,2}] square
439439
440440
positional arguments:
@@ -473,18 +473,18 @@ to count the number of occurrences of specific options.
473473

474474
.. code-block:: shell-session
475475
476-
$ python3 prog.py 4
476+
$ python prog.py 4
477477
16
478-
$ python3 prog.py 4 -v
478+
$ python prog.py 4 -v
479479
4^2 == 16
480-
$ python3 prog.py 4 -vv
480+
$ python prog.py 4 -vv
481481
the square of 4 equals 16
482-
$ python3 prog.py 4 --verbosity --verbosity
482+
$ python prog.py 4 --verbosity --verbosity
483483
the square of 4 equals 16
484-
$ python3 prog.py 4 -v 1
484+
$ python prog.py 4 -v 1
485485
usage: prog.py [-h] [-v] square
486486
prog.py: error: unrecognized arguments: 1
487-
$ python3 prog.py 4 -h
487+
$ python prog.py 4 -h
488488
usage: prog.py [-h] [-v] square
489489
490490
positional arguments:
@@ -493,7 +493,7 @@ to count the number of occurrences of specific options.
493493
options:
494494
-h, --help show this help message and exit
495495
-v, --verbosity increase output verbosity
496-
$ python3 prog.py 4 -vvv
496+
$ python prog.py 4 -vvv
497497
16
498498
499499
* Yes, it's now more of a flag (similar to ``action="store_true"``) in the
@@ -540,11 +540,11 @@ And this is what it gives:
540540

541541
.. code-block:: shell-session
542542
543-
$ python3 prog.py 4 -vvv
543+
$ python prog.py 4 -vvv
544544
the square of 4 equals 16
545-
$ python3 prog.py 4 -vvvv
545+
$ python prog.py 4 -vvvv
546546
the square of 4 equals 16
547-
$ python3 prog.py 4
547+
$ python prog.py 4
548548
Traceback (most recent call last):
549549
File "prog.py", line 11, in <module>
550550
if args.verbosity >= 2:
@@ -584,7 +584,7 @@ And:
584584

585585
.. code-block:: shell-session
586586
587-
$ python3 prog.py 4
587+
$ python prog.py 4
588588
16
589589
590590
You can go quite far just with what we've learned so far,
@@ -617,10 +617,10 @@ Output:
617617

618618
.. code-block:: shell-session
619619
620-
$ python3 prog.py
620+
$ python prog.py
621621
usage: prog.py [-h] [-v] x y
622622
prog.py: error: the following arguments are required: x, y
623-
$ python3 prog.py -h
623+
$ python prog.py -h
624624
usage: prog.py [-h] [-v] x y
625625
626626
positional arguments:
@@ -630,7 +630,7 @@ Output:
630630
options:
631631
-h, --help show this help message and exit
632632
-v, --verbosity
633-
$ python3 prog.py 4 2 -v
633+
$ python prog.py 4 2 -v
634634
4^2 == 16
635635
636636
@@ -655,11 +655,11 @@ Output:
655655

656656
.. code-block:: shell-session
657657
658-
$ python3 prog.py 4 2
658+
$ python prog.py 4 2
659659
16
660-
$ python3 prog.py 4 2 -v
660+
$ python prog.py 4 2 -v
661661
4^2 == 16
662-
$ python3 prog.py 4 2 -vv
662+
$ python prog.py 4 2 -vv
663663
Running 'prog.py'
664664
4^2 == 16
665665
@@ -727,16 +727,16 @@ demonstration. Anyways, here's the output:
727727

728728
.. code-block:: shell-session
729729
730-
$ python3 prog.py 4 2
730+
$ python prog.py 4 2
731731
4^2 == 16
732-
$ python3 prog.py 4 2 -q
732+
$ python prog.py 4 2 -q
733733
16
734-
$ python3 prog.py 4 2 -v
734+
$ python prog.py 4 2 -v
735735
4 to the power 2 equals 16
736-
$ python3 prog.py 4 2 -vq
736+
$ python prog.py 4 2 -vq
737737
usage: prog.py [-h] [-v | -q] x y
738738
prog.py: error: argument -q/--quiet: not allowed with argument -v/--verbose
739-
$ python3 prog.py 4 2 -v --quiet
739+
$ python prog.py 4 2 -v --quiet
740740
usage: prog.py [-h] [-v | -q] x y
741741
prog.py: error: argument -q/--quiet: not allowed with argument -v/--verbose
742742
@@ -771,7 +771,7 @@ but not both at the same time:
771771

772772
.. code-block:: shell-session
773773
774-
$ python3 prog.py --help
774+
$ python prog.py --help
775775
usage: prog.py [-h] [-v | -q] x y
776776
777777
calculate X to the power of Y

Doc/howto/clinic.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ If you run that script, specifying a C file as an argument:
8686

8787
.. code-block:: shell-session
8888
89-
$ python3 Tools/clinic/clinic.py foo.c
89+
$ python Tools/clinic/clinic.py foo.c
9090
9191
Argument Clinic will scan over the file looking for lines that
9292
look exactly like this:

Doc/howto/unicode.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ When run, this outputs:
449449

450450
.. code-block:: shell-session
451451
452-
$ python3 compare-strs.py
452+
$ python compare-strs.py
453453
length of first string= 1
454454
length of second string= 2
455455
True

Doc/library/__main__.rst

+8-8
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,22 @@ The top-level code environment can be:
6161

6262
.. code-block:: shell-session
6363
64-
$ python3 helloworld.py
64+
$ python helloworld.py
6565
Hello, world!
6666
6767
* the Python module or package passed to the Python interpreter with the
6868
:option:`-m` argument:
6969

7070
.. code-block:: shell-session
7171
72-
$ python3 -m tarfile
72+
$ python -m tarfile
7373
usage: tarfile.py [-h] [-v] (...)
7474
7575
* Python code read by the Python interpreter from standard input:
7676

7777
.. code-block:: shell-session
7878
79-
$ echo "import this" | python3
79+
$ echo "import this" | python
8080
The Zen of Python, by Tim Peters
8181
8282
Beautiful is better than ugly.
@@ -87,7 +87,7 @@ The top-level code environment can be:
8787

8888
.. code-block:: shell-session
8989
90-
$ python3 -c "import this"
90+
$ python -c "import this"
9191
The Zen of Python, by Tim Peters
9292
9393
Beautiful is better than ugly.
@@ -178,7 +178,7 @@ that your function will return some value acceptable as an input to
178178
returned if your function does not have a return statement).
179179

180180
By proactively following this convention ourselves, our module will have the
181-
same behavior when run directly (i.e. ``python3 echo.py``) as it will have if
181+
same behavior when run directly (i.e. ``python echo.py``) as it will have if
182182
we later package it as a console script entry-point in a pip-installable
183183
package.
184184

@@ -215,7 +215,7 @@ directly from the command line using the :option:`-m` flag. For example:
215215

216216
.. code-block:: shell-session
217217
218-
$ python3 -m bandclass
218+
$ python -m bandclass
219219
220220
This command will cause ``__main__.py`` to run. How you utilize this mechanism
221221
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:
320320

321321
.. code-block:: shell-session
322322
323-
$ python3 start.py
323+
$ python start.py
324324
Define the variable `my_name`!
325325
326326
The exit code of the program would be 1, indicating an error. Uncommenting the
@@ -329,7 +329,7 @@ status code 0, indicating success:
329329

330330
.. code-block:: shell-session
331331
332-
$ python3 start.py
332+
$ python start.py
333333
Dinsdale found in file /path/to/start.py
334334
335335
Note that importing ``__main__`` doesn't cause any issues with unintentionally

0 commit comments

Comments
 (0)