- Modular Programming with Python
- Erik Westra
- 247字
- 2021-07-16 10:47:17
Summary
In this chapter, we introduced the concept of Python modules and saw how Python modules are simply Python source files, which are imported and used by another source file. We then took a look at Python packages and saw that these are collections of modules identified by a package initialization file named __init__.py
.
We explored how modules and packages can be used to organize your program's source code and why the use of these modular techniques is so important for the development of large systems. We also explored what spaghetti code looks like and discovered some of the other pitfalls that can occur if you don't modularize your programs.
Next, we looked at programming as a process of constant change and evolution and how modular programming can help deal with a changing codebase in the best possible way. We then learned that the Python Standard Library is an excellent example of a large collection of modules and packages, and finished by creating our own simple Python module that demonstrates effective modular programming techniques. In implementing this module, we learned how a module can use leading underscores in variable and function names to mark them as private to the module, while making the remaining functions and other definitions available for other parts of the system to use.
In the next chapter, we will apply modular techniques to the development of a more sophisticated program consisting of several modules working together to solve a more complex programming problem.
- 計算思維與算法入門
- BeagleBone Media Center
- 樂高機器人設計技巧:EV3結構設計與編程指導
- C語言從入門到精通(第4版)
- ADI DSP應用技術集錦
- Visual C#.NET程序設計
- 運用后端技術處理業務邏輯(藍橋杯軟件大賽培訓教材-Java方向)
- C++寶典
- Java程序員面試筆試寶典(第2版)
- Java EE企業級應用開發教程(Spring+Spring MVC+MyBatis)
- Image Processing with ImageJ
- Raspberry Pi Robotic Projects(Third Edition)
- Vue.js應用測試
- 你好!Java
- Mastering JavaScript Promises