Issue33501
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2018-05-14 16:18 by carljm, last changed 2022-04-11 14:59 by admin.
| Messages (6) | |||
|---|---|---|---|
| msg316531 - (view) | Author: Carl Meyer (carljm) * | Date: 2018-05-14 16:18 | |
It doesn't make sense for e.g. docstring-stripping to necessarily imply assert-stripping. These are totally separate options, useful for separate reasons, but currently tied together in the `-O` option. This is not just a theoretical problem; at work we must strip docstrings in production for memory reasons, but we would prefer not to strip asserts. In fact we currently lint against use of `assert` because it is stripped in production, and we replace it with our own assertion function, which is less efficient and also integrates poorly with mypy's type binder. A better option would be to enable each of these separate optimizations with a separate command-line flag (probably a string tag passed to a single flag, e.g. `-o strip_docstrings`). PYC filename generation will also need to include all individually-enabled optimization string tags as part of the filename. For backwards-compatibility, the existing `-O` flags should still be supported with the same meaning they currently have; `-O` and the new granular `-o` should be additive. (A version of this was previously proposed as a minor part of PEP 511.) Please let me know if this proposal is of sufficient complexity that a PEP is needed instead of just an issue. |
|||
| msg316544 - (view) | Author: Brett Cannon (brett.cannon) * ![]() |
Date: 2018-05-14 18:06 | |
Reference to some discussions on this topic https://groups.google.com/forum/#!topic/python-ideas/4oRgwrV1tVA |
|||
| msg316905 - (view) | Author: Alyssa Coghlan (ncoghlan) * ![]() |
Date: 2018-05-17 10:38 | |
PSF link for Diana Clark's thread on python-ideas about this: https://mail.python.org/pipermail/python-ideas/2017-September/047224.html (this is the same thread Brett linked, just to the PSF archives rather than Google Groups) |
|||
| msg316908 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2018-05-17 10:46 | |
Isn't this a duplicate of the old issue2506? |
|||
| msg316926 - (view) | Author: Brett Cannon (brett.cannon) * ![]() |
Date: 2018-05-17 13:27 | |
I don't thnk they are quite the same. The other issue is about turning off the peepholer entirely while this one is about breaking up the optimizations that -O and -OO do so you can choose which ones you want (e.g. still drop docstrings but keep asserts). |
|||
| msg317080 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2018-05-19 00:36 | |
I'm not sure that the bug tracker is the best place to propose such idea. Maybe start a new thread on python-ideas? |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:00 | admin | set | github: 77682 |
| 2018-05-19 00:36:17 | vstinner | set | messages: + msg317080 |
| 2018-05-17 13:27:19 | brett.cannon | set | messages: + msg316926 |
| 2018-05-17 10:46:17 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg316908 |
| 2018-05-17 10:38:55 | ncoghlan | set | messages: + msg316905 |
| 2018-05-14 18:06:01 | brett.cannon | set | messages: + msg316544 |
| 2018-05-14 16:20:24 | steven.daprano | set | nosy:
+ steven.daprano |
| 2018-05-14 16:18:37 | carljm | create | |
