Possible import overhead
Closed this issue · 0 comments
Hannnsen commented
Python documentation mentions overhead produced by importing functions from modules like the following example shows:
def some_function():
from scipy import something, something_else
some_var = something(100)
return something_else(some_var)
def analysis():
for i in range(0, 1000):
some_function()
I would consider to place every import at the top of the files. I'll try this out, if the package version works, it's even possible to put it into the __init__.py
from the module, so you needed modules/packages get imported automatically and only once at a central point.