An alternative version of this idea would be to speed up import for those modules. I’m guessing that the simplest way to do that[1] would be to freeze them–i.e. prevent core modules like these from being modified under most circumstances. If the code object is sure to be constant, I believe it can be loaded much faster and more efficiently?
There will always need to be a way to allow such modification for workflows that need to do something strange to inspect
or shutil
or whatever. But my suspicion is that the vast majority of users aren’t doing any runtime modification to the standard library, and they assume none of their dependencies are doing it either.
But maybe my assumptions here are just wrong–there isn’t a path to faster loading by freezing the modules, or that would disable some very common workflow I didn’t know about…
without “just make everything fast” magic ↩︎