Python 2.7: Import Performance
currently, I am importing bunch of .py files scattered across the file system via: def do_import(name): import imp fp, pathname, description = imp.find_module(name) w
Solution 1:
If all of the files are under one directory, you can create an __init__.py
empty file in each level of the nested directory, and import the name of the root directory, like import root
in the following example:
/ root
- __init__.py
/ workingDir
- __init__.py
- import_one.py
/ anotherDir
- __init__.py
- import_two.py
That structure is called "package".
Post a Comment for "Python 2.7: Import Performance"