Is it Slower to Import an Entire Module Rather Than Select Functions From It?


#1

Does it slow you’re code at all to import an entire module rather than just select functions from it? Like in large projects that use many modules, would you want to limit how many functions you’ve “loaded” into Python?


FAQ: Learn Python: Functions - Universal Imports
#2

Hi @oofrostbyteoo,

Importing the entire module won’t slow your program down. When Python compiles the code, it leaves out anything that isn’t used. In fact, it looks like it’s faster to import the entire module: