Войти
  • 63800Просмотров
  • 4 года назадОпубликованоSreekanth

Pythons Import System - Module object|Regular/Namespace Packages|Finders & Loaders|Relative imports

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, cache, 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 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 --------- PEP-420 Implicit Namespace Packages: Dr. Fred Baptiste's course For more knowledge on this topic (David Beazley's PyCon 2015 talk): (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)