- 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.
- Google Apps Script for Beginners
- 自己動手寫搜索引擎
- Visual FoxPro程序設計教程(第3版)
- Expert Android Programming
- Android Native Development Kit Cookbook
- 量化金融R語言高級教程
- Corona SDK Mobile Game Development:Beginner's Guide(Second Edition)
- 新一代SDN:VMware NSX 網絡原理與實踐
- Django實戰:Python Web典型模塊與項目開發
- R Data Science Essentials
- 零基礎C#學習筆記
- Mastering ASP.NET Core 2.0
- 谷歌JAX深度學習從零開始學
- Instant AutoIt Scripting
- Java EE企業級應用開發教程:Spring+Spring MVC+MyBatis(第2版)