02.10.17 16:26, Victor Stinner пише: > While "import module" is fast, maybe we should use sometimes a global > variable to cache the import. > > module = None > def func(): > global module > if module is None: import module > ... I optimized "import module", and I think it can be optimized even more, up to making the above trick unnecessary. Currently there is an overhead of checking that the module found in sys.modules is not imported right now.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4