Are the following
import
statements equivalent:import mypack.mymod
andfrom mypack import mymod
in Python3?
Suppose I've the following directory directory hierarchy:
.
├── main.py
└── mypack
├── __init__.py
├── __pycache__
│ ├── __init__.cpython-37.pyc
│ └── mymod.cpython-37.pyc
└── mymod.py
When importing the mymod
module in main.py
are the import mypack.mymod
and from mypack import mymod
statements equivalent? I've been experimenting with both, and they seem to perform the exact same job.