- Secret Recipes of the Python Ninja
- Cody Jackson
- 134字
- 2021-06-25 22:14:43
How to create and reference module packages
We have talked about modules and packages, using the terms interchangeably. However, there is a difference between a module and a package: packages are actually collections of modules and they include a __init__.py file, which can just be an empty file.
The dot-nomenclature used in modules to access specific functions or variables is also used in packages. This time, dotted names allow multiple modules within a package to be accessed without having name conflicts; each package creates its own namespace, and all the modules have their own namespaces.
When packages contain sub-packages (as in the following example), importing modules can be done with either absolute or relative paths. For example, to import the sepia.py module, one could import it with an absolute path: from video.effects.specialFX import sepia.
- Learning C# by Developing Games with Unity 2020
- Learning Spring 5.0
- Python 深度學習
- 動手玩轉Scratch3.0編程:人工智能科創教育指南
- JavaScript Unlocked
- 軟件測試項目實戰之性能測試篇
- Blockly創意趣味編程
- Python 3網絡爬蟲實戰
- Mastering AndEngine Game Development
- Learning Data Mining with R
- iOS開發實戰:從入門到上架App Store(第2版) (移動開發叢書)
- Visual Basic程序設計實驗指導(第二版)
- Java SE實踐教程
- Android驅動開發權威指南
- R Data Science Essentials