Dear all,
I am reading the book "Core Python Programming". In the chapter talking about modules, it says the modules should follow this ordering:
I am not sure whether the ordering will impact the module's loading or search efficiency. For example, a common module in the standard library can be free from being imported several times, if this module will be imported by application-specific modules.
test.py
MyModuleA.py
MyModuleB.py
If we follow the ordering to import the modules, here we import standard library "os", we may save some time, right? It's only my assumption and I am not sure I am right. But I am curious to know whether there are some benefits we can get from the this ordering.
Could anyone be kind enough to give me the answer? Thanks a lot.
Have a nice holiday!
I am reading the book "Core Python Programming". In the chapter talking about modules, it says the modules should follow this ordering:
Code:
import Python Standard Library modules import Python third party modules import Application-specific modules
test.py
Code:
#test.py import os import MyModuleA import MyModuleB ...
Code:
#MyModuleA.py import os ...
Code:
#MyModuleB.py import os ...
Could anyone be kind enough to give me the answer? Thanks a lot.
Have a nice holiday!
Comment