I don't understand your question.
I guess that your real question is: are stdlib modules loaded with peephole optimizer enabled or not?
If you use -o noopt, you are safe: the peephole optimizer is disabled before the first Python import.
If you use sys.set_code_transformers([]) in your code, it's likely that Python already imported 20 or 40 modules during its initialization (especially in the site module).
It's up to you to pick the best option. There are different usages for each option. Maybe you just don't care of the stdlib, you only want to debug your application code, so it's doesn't matter how the stlidb is optimized?
--
Or are you asking me to remove sys.set_code_transformers([]) from the section "Usage 3: Disable all optimization"? I don't understand. That is exactly the issue with setting a transformer at runtime which I don't understand. That is one weakness of the PEP; some people already
On 28.01.2016 18:03, Victor Stinner wrote: proposed to make a difference between - local transformation - global transformation I can understand the motivation to have the same API for both, but's inherently different and it makes talking about it hard (as we can see now). I would like to have this clarified in the PEP (use consistent wording) or even split it up into two different parts of the PEP. You said I would need to call the function before all imports. Why is that? Can I not call it it twice in the same file? Or in a loop? What will happen? Will the file get recompiled each time? Some people proposed a "from __extensions__ import my_extension"; inspired by __future__ imports, i.e. it is forced to be at the top. Why? Because it somehow makes sense to perform all transformations the first time a file is loaded. I don't see that addressed in the PEP. I have to admit I would prefer this kind usage over a function call. Furthermore: - we already have import hooks. They can be used for local transformation. I don't see that addressed in the PEP. - after re-reading the PEP I have some difficulties to see how to activate, say, 2 custom transformers **globally** (via -o). Maybe, adding an example would help here.