File tree Expand file tree Collapse file tree 4 files changed +23
-6
lines changed
NEWS.d/next/Documentation Expand file tree Collapse file tree 4 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -246,12 +246,23 @@ Miscellaneous options
246
246
247
247
.. cmdoption :: -O
248
248
249
- Turn on basic optimizations. See also :envvar: `PYTHONOPTIMIZE `.
249
+ Remove assert statements and any code conditional on the value of
250
+ :const: `__debug__ `. Augment the filename for compiled
251
+ (:term: `bytecode `) files by adding ``.opt-1 `` before the ``.pyc ``
252
+ extension (see :pep: `488 `). See also :envvar: `PYTHONOPTIMIZE `.
253
+
254
+ .. versionchanged :: 3.5
255
+ Modify ``.pyc `` filenames according to :pep: `488 `.
250
256
251
257
252
258
.. cmdoption :: -OO
253
259
254
- Discard docstrings in addition to the :option: `-O ` optimizations.
260
+ Do :option: `-O ` and also discard docstrings. Augment the filename
261
+ for compiled (:term: `bytecode `) files by adding ``.opt-2 `` before the
262
+ ``.pyc `` extension (see :pep: `488 `).
263
+
264
+ .. versionchanged :: 3.5
265
+ Modify ``.pyc `` filenames according to :pep: `488 `.
255
266
256
267
257
268
.. cmdoption :: -q
Original file line number Diff line number Diff line change
1
+ Clarify docs for -O and -OO. Patch by Terry Reedy.
Original file line number Diff line number Diff line change @@ -156,10 +156,13 @@ for the named module and runs the corresponding
156
156
file as a script.
157
157
.TP
158
158
.B \- O
159
- Turn on basic optimizations. Given twice, causes docstrings to be discarded.
159
+ Remove assert statements and any code conditional on the value of
160
+ __debug__; augment the filename for compiled (bytecode) files by
161
+ adding .opt-1 before the .pyc extension.
160
162
.TP
161
163
.B \- OO
162
- Discard docstrings in addition to the \fB -O \fP optimizations.
164
+ Do \fB -O \fP and also discard docstrings; change the filename for
165
+ compiled (bytecode) files by adding .opt-2 before the .pyc extension.
163
166
.TP
164
167
.B \- q
165
168
Do not print the version and copyright messages. These messages are
Original file line number Diff line number Diff line change @@ -64,8 +64,10 @@ static const char usage_2[] = "\
64
64
if stdin does not appear to be a terminal; also PYTHONINSPECT=x\n\
65
65
-I : isolate Python from the user's environment (implies -E and -s)\n\
66
66
-m mod : run library module as a script (terminates option list)\n\
67
- -O : optimize generated bytecode slightly; also PYTHONOPTIMIZE=x\n\
68
- -OO : remove doc-strings in addition to the -O optimizations\n\
67
+ -O : remove assert and __debug__-dependent statements; add .opt-1 before\n\
68
+ .pyc extension; also PYTHONOPTIMIZE=x\n\
69
+ -OO : do -O changes and also discard docstrings; add .opt-2 before\n\
70
+ .pyc extension\n\
69
71
-q : don't print version and copyright messages on interactive startup\n\
70
72
-s : don't add user site directory to sys.path; also PYTHONNOUSERSITE\n\
71
73
-S : don't imply 'import site' on initialization\n\
You can’t perform that action at this time.
0 commit comments