The key question is whether this level of configuration is generally
useful enough to be worth us maintaining it in OE-Core. I don't know if
this is something you needed for a one off investigation or that people
need it in general.
I think it would be good to step back and look at what these
optimization levels actually do. Upstream clearly treats them as
optional opt-in via python interpreter command line switch or
environment variable, which means they don't think picking a higher
default level is something python users should be doing. So why would
we be going against this approach?
The reason to use these features of the Python interpreter is that we develop for
resource restricted devices. The target device should not need to compile the Python
files to byte-code at runtime (which happens regardless of the optimization level).
We can do this work at build time. Moreover, Embedded devices usually
have restricted storage size. So using the optimization level 2 for pyc files is sensible.
Most embedded devices don't need the docstrings in the Python files (simmilar to
not needing the man pages). So we can get rid of them (that is what optimization
level 2 does, apart from disabling asserts).
Lukas