News for hackers. Stuff that matters.
Re:Symbian Source Code by OOPMan on Wednesday May 25, 2022 @07:33AM (#31503046)
I've run into the import issue as well, it's especially painful if something imported is doing work using a slow library (e.g. a config module loading a HOCON config using pyhocon a.k.a slowasmolasseshocon)
Re:Symbian Source Code by KolenCh on Wednesday May 25, 2022 @07:06PM (#31512008)
That will be another slow down happening at import stage. But even if ideally everything you import only does import with not much work, the import overhead mentioned above still exists. But frankly I’m not sure how significant it is on a typical personal computer with SSD, especially when the OS may cache recently used files already.

The problem you mention can be significant because some design patterns in Python encourages this. Eg function arg with a default that’s expensive. Unfortunately this whole speeds up repeatedly calling the func, the cost is paid at first import.