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/i...
https://docs.python.org/3/tutorial/mo...
https://docs.python.org/3/library/imp...
PEP-420 Implicit Namespace Packages: https://www.python.org/dev/peps/pep-0...
Dr. Fred Baptiste's course https://www.udemy.com/course/python-3...
For more knowledge on this topic (David Beazley's PyCon 2015 talk): • David Beazley - Modules and Packages:...
(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)
Watch video Python's Import System - Module object|Regular/Namespace Packages|Finders & Loaders|Relative imports online, duration hours minute second in high quality that is uploaded to the channel Sreekanth 26 July 2021. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 50,926 times and liked it 1.4 thousand visitors.