Python imports

Question:

Good day!

Using a construction like:

from a import *

But not using all the classes / functions, etc. from a , can we say that this affects the speed of the program, the amount of required memory? Or is it not scary for python?

Answer:

Actually, the runtime will be about the same, except that using the from smth import * construction in the local context, references to all objects defined in smth will be created. "Cascading import all the way" will happen anyway.

Scroll to Top