- Secret Recipes of the Python Ninja
- Cody Jackson
- 172字
- 2021-06-25 22:14:38
Introduction
Python modules are the highest-level components of Python programs. As suggested by their name, modules are modular, capable of being plugged in with other modules as part of an overall program to provide better separation of code while combining together to create a cohesive application.
Modules allow easy reuse of code, and provide separate namespaces to prevent variable shadowing between blocks of code. Variable shadowing involves having duplicate variables in different namespaces, possibly causing the interpreter to use an incorrect variable. Each Python file a developer creates is considered a separate module, allowing different files to be imported into a single, overall file that forms the final application.
Realistically, any Python file can be made a module by simply removing the .py extension; this is most commonly seen when importing libraries. Python packages are collections of modules; what makes a package special is the inclusion of an __init__.py file. We will cover the differences in detail later, so for now just recognize that there are several names for the same items.
- 大學計算機基礎(第二版)
- Advanced Machine Learning with Python
- Learning ROS for Robotics Programming(Second Edition)
- LabVIEW 2018 虛擬儀器程序設計
- Vue.js前端開發基礎與項目實戰
- Python自動化運維快速入門
- JavaScript Unlocked
- Visual Basic學習手冊
- HDInsight Essentials(Second Edition)
- 領域驅動設計:軟件核心復雜性應對之道(修訂版)
- PLC應用技術(三菱FX2N系列)
- Web前端應用開發技術
- Node.js 12實戰
- 代碼閱讀
- Analytics for the Internet of Things(IoT)