On Thu, 2 Nov 2017 05:57 am, Stefan Ram wrote: > I also have heard that there was a module cache, so I > was hoping that a second import of the same module might > not be such an effort for the implementation.
There is: sys.modules. Although `import spam` is cheap when spam is in the cache, its not free, and `__import__("spam")` is even less cheap (more costly). Its a function call, not a statement, so it requires a runtime name lookup and a function call on top of the same process of checking the cache and importing the module. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list