- 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.
- Python 3網(wǎng)絡(luò)爬蟲實(shí)戰(zhàn)
- 假如C語言是我發(fā)明的:講給孩子聽的大師編程課
- Java軟件開發(fā)基礎(chǔ)
- 人人都是網(wǎng)站分析師:從分析師的視角理解網(wǎng)站和解讀數(shù)據(jù)
- MongoDB權(quán)威指南(第3版)
- Python機(jī)器學(xué)習(xí)算法與實(shí)戰(zhàn)
- Flutter跨平臺開發(fā)入門與實(shí)戰(zhàn)
- Instant Ext.NET Application Development
- Learning Apache Karaf
- Getting Started with React Native
- Building Dynamics CRM 2015 Dashboards with Power BI
- Python程序設(shè)計(jì)開發(fā)寶典
- CodeIgniter Web Application Blueprints
- C#面向?qū)ο蟪绦蛟O(shè)計(jì)(第2版)
- Getting Started with JUCE