- 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.
- OpenCV實例精解
- R語言編程指南
- Visual Basic學習手冊
- 小程序,巧運營:微信小程序運營招式大全
- Mastering AndEngine Game Development
- 精通網絡視頻核心開發技術
- C語言實驗指導及習題解析
- INSTANT Django 1.5 Application Development Starter
- Keras深度學習實戰
- Mastering Data Mining with Python:Find patterns hidden in your data
- Python語言實用教程
- C專家編程
- Webpack實戰:入門、進階與調優(第2版)
- Lift Application Development Cookbook
- Unity Character Animation with Mecanim