msg182365 - (view) |
Author: Maciej Fijalkowski (fijall) * |
Date: 2013-02-19 06:25 |
This is what the current documentation says:
-O
Turn on basic optimizations. This changes the filename extension for compiled (bytecode) files from .pyc to .pyo. See also PYTHONOPTIMIZE.
-OO
Discard docstrings in addition to the -O optimizations.
As far as I know, the only "optimization" that's done is removal of __debug__ sections and assert statements and has been like this for years. Maybe it should say so "-O does not do any optimizations, only removes assert statement" or so.
|
msg182373 - (view) |
Author: Ramchandra Apte (Ramchandra Apte) * |
Date: 2013-02-19 12:34 |
It should also add that in the future, more optimizations may be added i.e. a peephole optimizer, etc.
|
msg182377 - (view) |
Author: Maciej Fijalkowski (fijall) * |
Date: 2013-02-19 12:40 |
There were not for at least 10 years. I would also be the first one to strongly object adding optimizations only under -O, because that already changes semantics.
|
msg182380 - (view) |
Author: Alyssa Coghlan (ncoghlan) * |
Date: 2013-02-19 14:12 |
Ramchandra, as it turns out, if we deem an optimization semantically safe, we do it without -O, it we deem it unsafe, we don't do it at all.
Thus, the real effect is to remove assert statements and optimise code as if "__debug__" was replaced by a literal zero (effectively).
So a more meaningful description would be:
-O
Removes assert statements and any code conditional on the value of __debug__. This changes the filename extension for compiled (bytecode) files from .pyc to .pyo. See also PYTHONOPTIMIZE.
|
msg182680 - (view) |
Author: Terry J. Reedy (terry.reedy) * |
Date: 2013-02-22 18:43 |
I agree that we should document exactly what is now. Patch replaces first sentence with Nick's. It is against 3.4, but should be identical for all versions. Maciej, thanks for reminding us to finally fix this.
|
msg182681 - (view) |
Author: Antoine Pitrou (pitrou) * |
Date: 2013-02-22 18:45 |
Should probably be "Remove", not "Removes" (we use infinitives to describe the actions undertaken by a command / option / method ...).
|
msg182682 - (view) |
Author: Terry J. Reedy (terry.reedy) * |
Date: 2013-02-22 18:46 |
Perhaps '__debug__' need markup, but if so, I don't know how.
And I agree with Antoine.
|
msg182729 - (view) |
Author: Alyssa Coghlan (ncoghlan) * |
Date: 2013-02-23 10:11 |
+1 for Remove instead of Removes
For the online docs, :const:`__debug__` should work (resolving to http://docs.python.org/3/library/constants.html#__debug__, which is currently described using some slightly brain-bending phrasing)
We should also tweak the output of "python -h" (the help string is in ./Modules/main.c)
|
msg182738 - (view) |
Author: Eli Bendersky (eli.bendersky) * |
Date: 2013-02-23 13:20 |
+1, I've been bothered by this description of "optimization" for a long time.
Terry's patch LGTM
|
msg182742 - (view) |
Author: Maciej Fijalkowski (fijall) * |
Date: 2013-02-23 13:34 |
Also IMO -OO should stop talking about optimizations. Maybe "Do what -O does and discard docstrings"?
|
msg184047 - (view) |
Author: Terry J. Reedy (terry.reedy) * |
Date: 2013-03-12 20:10 |
I added :const: and tweaked -OO entry and -h startup display.
Tested new html and python_d -h. Any other comments before I apply?
|
msg184048 - (view) |
Author: Antoine Pitrou (pitrou) * |
Date: 2013-03-12 20:17 |
There's a typo in your patch:
+-O : remove assert and __debug__-dependent statements; change .py\n\
+ to .pyo; also PYTHONOPTIMIZE=x\n\
should say ".pyc", not ".py".
|
msg184049 - (view) |
Author: Antoine Pitrou (pitrou) * |
Date: 2013-03-12 20:18 |
Also, in 3.2 and higher I'm not sure there's a point in mentioning pyc/pyo files; they're all shelved in __pycache__ now.
|
msg184051 - (view) |
Author: Terry J. Reedy (terry.reedy) * |
Date: 2013-03-12 21:28 |
I corrected my copy of the .diff.
Since this issue is so far focused on removing the false optimize claim, hiding .pyx info is a new sub-issue. I will follow whatever the consensus is, but since this is a cpython-specific doc and help, I would prefer to give complete info. In fact, I would like to add 'stored in __pycache__' or even 'hidden away in __pycache__', the latter to suggest that most people should generally forget about them. On Windows, _xxx files like __pycache__ appear in both Command Prompt dir and Explorer file listings, so beginners need to known that __cache__ is both normal and ignorable.
|
msg184070 - (view) |
Author: Alyssa Coghlan (ncoghlan) * |
Date: 2013-03-13 06:56 |
On Tue, Mar 12, 2013 at 1:18 PM, Antoine Pitrou <report@bugs.python.org> wrote:
>
> Antoine Pitrou added the comment:
>
> Also, in 3.2 and higher I'm not sure there's a point in mentioning pyc/pyo files; they're all shelved in __pycache__ now.
It still makes a difference for bytecode-only files, which aren't in __pycache__
Cheers,
Nick.
|
msg184141 - (view) |
Author: Ezio Melotti (ezio.melotti) * |
Date: 2013-03-14 07:47 |
I left a review on rietveld.
|
msg195475 - (view) |
Author: Ezio Melotti (ezio.melotti) * |
Date: 2013-08-17 14:30 |
Terry, do you want to update your patch?
|
msg312597 - (view) |
Author: Cheryl Sabella (cheryl.sabella) * |
Date: 2018-02-22 22:09 |
Should I make a pull request for Terry's last patch?
|
msg312600 - (view) |
Author: Terry J. Reedy (terry.reedy) * |
Date: 2018-02-22 22:45 |
Cheryl: yes, with changes in responses to Ezio's review.
Nick or Antoine: has there been any change to meaning of -O or -OO that I am not remembering?
|
msg312611 - (view) |
Author: Alyssa Coghlan (ncoghlan) * |
Date: 2018-02-23 02:00 |
We don't change the extension on optimised pyc files any more, we add an optimisation marker to the name without changing the file extension: https://www.python.org/dev/peps/pep-0488/
(This means `-O` and `-OO` don't tread on each other any more)
|
msg312658 - (view) |
Author: Cheryl Sabella (cheryl.sabella) * |
Date: 2018-02-23 18:05 |
I've made a PR and tried to integrate the changes from PEP 488.
|
msg312771 - (view) |
Author: Terry J. Reedy (terry.reedy) * |
Date: 2018-02-25 03:04 |
New changeset 186b606d8a2ea4fd51b7286813302c8e8c7006cc by Terry Jan Reedy (Cheryl Sabella) in branch 'master':
bpo-17232: Clarify docs for -O and -OO command line options (#5839)
https://github.com/python/cpython/commit/186b606d8a2ea4fd51b7286813302c8e8c7006cc
|
msg312772 - (view) |
Author: miss-islington (miss-islington) |
Date: 2018-02-25 03:24 |
New changeset b5655f3d187084579ff389dbd8734742a8b66cbc by Miss Islington (bot) in branch '3.7':
bpo-17232: Clarify docs for -O and -OO command line options (GH-5839)
https://github.com/python/cpython/commit/b5655f3d187084579ff389dbd8734742a8b66cbc
|
msg312773 - (view) |
Author: miss-islington (miss-islington) |
Date: 2018-02-25 03:46 |
New changeset fc9471a888f373aedff3c118ae9a6cbf2037bd7c by Miss Islington (bot) in branch '3.6':
bpo-17232: Clarify docs for -O and -OO command line options (GH-5839)
https://github.com/python/cpython/commit/fc9471a888f373aedff3c118ae9a6cbf2037bd7c
|
|
Date |
User |
Action |
Args |
2022-04-11 14:57:41 | admin | set | github: 61434 |
2018-02-25 04:08:45 | terry.reedy | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
2018-02-25 03:46:18 | miss-islington | set | messages:
+ msg312773 |
2018-02-25 03:24:10 | miss-islington | set | nosy:
+ miss-islington messages:
+ msg312772
|
2018-02-25 03:06:50 | miss-islington | set | pull_requests:
+ pull_request5642 |
2018-02-25 03:05:51 | miss-islington | set | pull_requests:
+ pull_request5641 |
2018-02-25 03:04:43 | terry.reedy | set | messages:
+ msg312771 |
2018-02-23 18:05:03 | cheryl.sabella | set | messages:
+ msg312658 |
2018-02-23 18:02:26 | cheryl.sabella | set | stage: needs patch -> patch review pull_requests:
+ pull_request5616 |
2018-02-23 02:00:01 | ncoghlan | set | messages:
+ msg312611 |
2018-02-22 22:45:01 | terry.reedy | set | messages:
+ msg312600 versions:
+ Python 3.6, Python 3.7, Python 3.8, - Python 3.4, Python 3.5 |
2018-02-22 22:09:31 | cheryl.sabella | set | nosy:
+ cheryl.sabella messages:
+ msg312597
|
2016-09-12 10:31:50 | berker.peksag | link | issue27604 superseder |
2016-02-29 14:47:02 | vstinner | set | nosy:
+ vstinner
|
2016-02-29 14:44:23 | berker.peksag | set | nosy:
+ berker.peksag
|
2015-03-21 17:10:00 | serhiy.storchaka | set | stage: patch review -> needs patch versions:
+ Python 3.5, - Python 3.3 |
2013-11-29 21:50:01 | Arfrever | set | nosy:
+ Arfrever
|
2013-11-28 01:08:46 | martin.panter | set | nosy:
+ martin.panter
|
2013-08-17 14:30:38 | ezio.melotti | set | messages:
+ msg195475 versions:
- Python 3.2 |
2013-03-14 07:47:41 | ezio.melotti | set | nosy:
+ ezio.melotti
messages:
+ msg184141 stage: patch review |
2013-03-13 06:56:01 | ncoghlan | set | messages:
+ msg184070 |
2013-03-12 21:28:04 | terry.reedy | set | messages:
+ msg184051 |
2013-03-12 20:18:28 | pitrou | set | messages:
+ msg184049 |
2013-03-12 20:17:37 | pitrou | set | messages:
+ msg184048 |
2013-03-12 20:10:06 | terry.reedy | set | files:
+ 17232-O.diff assignee: docs@python -> terry.reedy messages:
+ msg184047
|
2013-02-23 13:34:48 | fijall | set | messages:
+ msg182742 |
2013-02-23 13:20:00 | eli.bendersky | set | nosy:
+ eli.bendersky messages:
+ msg182738
|
2013-02-23 10:11:47 | ncoghlan | set | messages:
+ msg182729 |
2013-02-22 18:46:12 | terry.reedy | set | messages:
+ msg182682 |
2013-02-22 18:45:11 | pitrou | set | nosy:
+ pitrou messages:
+ msg182681
|
2013-02-22 18:43:37 | terry.reedy | set | files:
+ issue17232.diff versions:
+ Python 2.7, Python 3.2, Python 3.3, Python 3.4 nosy:
+ terry.reedy
messages:
+ msg182680
keywords:
+ patch |
2013-02-19 14:54:54 | brett.cannon | set | nosy:
+ brett.cannon
|
2013-02-19 14:12:03 | ncoghlan | set | nosy:
+ ncoghlan messages:
+ msg182380
|
2013-02-19 12:40:48 | fijall | set | messages:
+ msg182377 |
2013-02-19 12:34:30 | Ramchandra Apte | set | nosy:
+ Ramchandra Apte messages:
+ msg182373
|
2013-02-19 06:25:01 | fijall | create | |