Python's Import System - Module object|Regular/Namespace Packages|Finders & Loaders|Relative import
Описание
This video explains details of Python's import system (import protocol) involving modules and packages (regular and namespace packages). Along the way, we will see finder and loader objects, sys.modules cache, sys.path and we will also implement an equivalent of the 'import' statement. We will also look into the reason for writing "__name__ == '__main__'".
----- Chapters -------
0:00 Introduction
0:50 Module object
2:10 Module attributes
3:59 Finders and loaders
7:16 sys.modules cache
8:56 Reloading a module
10:41 Implementing 'import' ourselves
12:17 Import Variants
14:39 __name__ == '__main__'
16:25 Packages Introduction
17:13 Regular packages
18:52 Nested modules
20:49 Nested packages
21:55 Flattening module namespace
23:59 Relative imports
24:57 Controlling exports
26:23 Namespace packages
27:34 Importing from zip files
28:18 -m option
Reference
---------
https://docs.python.org/3/reference/import.html
https://docs.python.org/3/tutorial/modules.html
https://docs.python.org/3/library/importlib.html
PEP-420 Implicit Namespace Packages: https://www.python.org/dev/peps/pep-0420/
Dr. Fred Baptiste's course https://www.udemy.com/course/python-3-deep-dive-part-1/
For more knowledge on this topic (David Beazley's PyCon 2015 talk): https://youtu.be/0oTh1CXRaQ0
(I saw this video after starting preparation of this video and I haven't completely watched it yet. The video contains much more interesting details about the import system)
Рекомендуемые видео



















