In the mean time, I've re-opened the following pull request that can be merged independent of these changes (it's just additional test coverage).
trivial: add test coverage for the __debug__ case (optimization levels) https://github.com/python/cpython/pull/3450 Please let me know if I should create a bpo for it, if the commit message is too long, or if you think I should otherwise change the patch in any way. As always, thanks for your time folks! --diana On Fri, Sep 29, 2017 at 2:24 PM, Diana Clarke <diana.joan.cla...@gmail.com> wrote: > Oh, I like this idea! > > I had very briefly considered treating the existing flag as a > bitfield, but then promptly forgot to explore that line of thought > further. > > I'll play with that approach next week, see where it takes me, and > then report back. > > Thanks so much for taking the time to think this through with me – > much appreciated. > > Cheers, > > --diana > > On Fri, Sep 29, 2017 at 1:33 AM, Nick Coghlan <ncogh...@gmail.com> wrote: >> 2. We could reinterpret "optimize" as a bitfield instead of a regular >> integer, special casing the already defined values: >> >> - all zero: no optimizations >> - sign bit set: negative -> use global settings >> - 0x0001: nodebug+noassert >> - 0x0002: nodebug+noassert+nodocstrings >> - 0x0004: nodebug >> - 0x0008: noassert >> - 0x0010: nodocstrings >> >> The "redefine optimizations as a bitfield" approach seems particularly >> promising to me - it's a full integer, so even with all negative >> numbers disallowed and the two low order bits reserved for the legacy >> combinations, that's still 29 different optimisation flags given >> 32-bit integers. We currently have 3, so that's room for an 866% >> increase in the number of defined flags :) _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/