On Fri, Mar 6, 2015 at 9:34 AM, Brett Cannon <bcan...@gmail.com> wrote: > Not specifying the optimization level when it is at 0 > ----------------------------------------------------- > > It has been suggested that for the common case of when the > optimizations are at level 0 that the entire part of the file name > relating to the optimization level be left out. This would allow for > file names of ``.pyc`` files to go unchanged, potentially leading to > less backwards-compatibility issues (although Python 3.5 introduces a > new magic number for bytecode so all bytecode files will have to be > regenerated regardless of the outcome of this PEP). > > It would also allow a potentially redundant bit of information to be > left out of the file name if an implementation of Python did not > allow for optimizing bytecode. This would only occur, though, if the > interpreter didn't support ``-O`` **and** didn't implement the ast > module, else users could implement their own optimizations.
The presence of the "opt-0" part in the filename could imply that there are other supported optimization levels, even when there aren't. So leaving that out when optimizations aren't supported may be a good idea. Perhaps add sys.implementation.supports_optimization or something like that? Then only leave "opt-0" off if the implementation does not support any optimization. --eric _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com