Solve the disadvantages of programming with the design concept of Python Programming Language

Source: Internet
Author: User

This article introduces the actual application and operation solutions and examples of relevant code, as well as the correction of programming habits that have drawbacks by using the Python programming language design philosophy. The following is a detailed introduction of the article. I hope you will have better knowledge in the design concepts of the Python programming language.

Python Programming Language Design Philosophy

Scalability. New built-in module) can be written in C or C ++. You can also add Python interfaces to existing modules. This allows you to avoid excessive syntax and focus on the program tasks to be implemented. Clear. For a specific problem, you only need to have the best solution.

Statement:

 
 
  1. There should be one-- and preferably 
    only one --obvious way to do it. 

The syntax is highly restrictive, and bad programming habits, such as not indent to the right of the next line of the if statement, cannot be compiled. This intentionally forces programmers to develop good programming habits. One of the most important items is the indentation rule of Python.

For example, if statement:

 
 
  1. if age<21: 
  2. print "You cannot buy wine!\n"  
  3. print "But you can buy chewing gum.\n"  
  4. print "this is outside if\n" 

The difference from most other languages, such as C) is that the boundaries of a module, it is determined by the position of the first character of each line in this line, while the C language uses a pair of curly braces {} to specify the boundary of the module, which has nothing to do with the position of the character ). This has caused controversy. Since the birth of C language, the separation of syntax meaning and character arrangement has been considered an improvement of the programming language.

But it is undeniable that Python makes the program clearer and more beautiful by forcing programmers to indent all the places where they need to use modules, such as if, for, and function definition. In addition, Python also adheres to a clear and uniform style in the design of other parts, making Python a language that is easy to read, easy to maintain, and widely used.

Application Scope of the Python Programming Language

System Programming: the lass = innerlink> API can facilitate system maintenance and management. One of the iconic languages in Linux is an ideal programming tool for many system administrators.

Graphic Processing, supported by PIL, Tkinter, and other graphics libraries, allows you to conveniently process images.

  • Advantages of Python compared with Perl in practical applications
  • The contents of the Directory obtained by the Python programming language and
  • Use OS. path. isdir () in the Python Programming Language ()
  • Python specific application in Zope Software Development
  • Advantages of the Python Programming Language

The NumPy extension provides a large number of interfaces with many standard math libraries.

For text processing, the re module provided by python supports regular expressions and the SGML and XML analysis modules. Many programmers use python to develop XML programs.

Database Programming, programmers can communicate with Microsoft SQL Server, Oracle, Sybase, DB2, Mysql, SQLite and other databases by following the Python DB-API database application programming interface.
Python comes with a Gadfly module that provides a complete SQL environment.

Network programming provides rich modules to support sockets programming, allowing you to develop distributed applications conveniently and quickly.
As a Web application development language, it supports the latest XML technology.

For multimedia applications, Python's PyOpenGL module encapsulates the "OpenGL Application Programming Interface" for 2D and 3D image processing. The PyGame module can be used to compile game software.

Related Article

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.