Python Module design Concept

Source: Internet
Author: User

Python Module Design Concept:

  • Always write code within a Python module: Wood has the means to write code that is not within a module, in fact, the program code entered at the interactive mode prompt is actually inside the built-in module __MAIN__. The interactive mode prompt is unique in that the program is discarded immediately after execution and the expression results are automatically printed
  • Module coupling to the lowest: global variables, just like functions, if written into a closed box, the module runs best. The principle is that the module should be as free of shared global variables as possible with other modules
  • Maximize the adhesion of the module: the same target. The coupling of the module can be minimized by maximizing the adhesion of the module, which is unlikely to depend on the external variable name if all elements of the module want to have a common purpose.
  • Modules should be less able to modify the variables of other modules


module is object: meta-Program
Because the modules show most of their interesting features through built-in properties, it is easy to write programs to manage other programs. Called this kind of program as meta-Program

Python Module design Concept

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.