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.

Author carljm
Recipients brett.cannon, carljm, eric.snow, lukasz.langa, ncoghlan, vstinner
Date 2018-05-14.16:18:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1526314717.24.0.682650639539.issue33501@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-05-14 16:18:37carljmsetrecipients: + carljm, brett.cannon, ncoghlan, vstinner, lukasz.langa, eric.snow
2018-05-14 16:18:37carljmsetmessageid: <1526314717.24.0.682650639539.issue33501@psf.upfronthosting.co.za>
2018-05-14 16:18:37carljmlinkissue33501 messages
2018-05-14 16:18:37carljmcreate