Improvement to imports, what is a better way ?

Michael Torrie torriem at gmail.com
Wed Jan 18 17:47:51 EST 2023


On 1/18/23 14:42, Dan Kolis wrote:
> 
>> I don't think you've described this. I don't know what you mean here. 
> 
> When I trace it in VSCode the imports seem like they endlessly suspend scanning and go to other ones over and over. Like "Whats this doing ?"
> 

Nothing to worry about there. Python knows what it's doing! :)  Lots of
modules import other modules, so there will be a spanning tree of sorts.
 Each module will only actually be formally imported once.  The rest is
just setting up name spaces.  Yes it all adds to run time latency, but
it certainly won't lead to any leaks.

Definitely there's no need to import a module's dependencies; it will do
that itself.  Just import what your own module explicitly needs.


More information about the Python-list mailing list