Here is the corresponding structure for urllib package in Python 3.3.3
urllib/ __init__.py <-- empty file request.py parse.py
There is a line next to the top of the request module, which looks like this:
from urllib.parse import some, helper, functions
And this line, which is the cause of urllib.parse , falls into scope.
You can verify that the implementation of import urllib.parse , on the other hand, does not cause the import of urllib.request . It will necessarily bind the name urllib (since urllib.parse is not a valid identifier by itself), but it will not import any other submodules.
Note. If you did one of the following:
import urllib.request as urllib_dot_request from urllib import request
Then you will have neither urllib nor urllib.parse available in the namespace. They will still be imported by the modular loader, but will not be included in the scope.
source share