The Python design concept is also a new discovery of computer language applications

Source: Internet
Author: User

What we can expand in computer language applications is that Python, as a common programming language, has its own characteristics. The new built-in modules can be written in C or C ++. If you have your own ideas on the Python design concept, we recommend that you watch our ideas on the Python design concept. We can also add Python interfaces to existing modules. Python allows you to focus on the program tasks to be implemented by avoiding excessive syntax constraints.

Python is also known as a clear language. The general guiding ideology of its authors when designing it is that there is only one best solution to a specific problem. This is expressed in The python motto "The Zen of Python" written by Tim Peters:

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

Interestingly, this is exactly the opposite of the central idea of TMTOWTDIThere's More Than One Way To Do It. This seems to be an important reason why people often compare Perl with Python.

The Python language is a clear language. Another meaning is that its author intentionally has a very restrictive syntax for the Python design concept, so that bad programming habits such as the if statement's next line does not indent to the right) can not 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 between a module and most other languages, such as C) is the boundary of a module, it is entirely 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 clearly define the boundary of the module, is irrelevant to the character position ). This has caused controversy.

Since the birth of a language like C, the Syntactic meaning of the language is separated from the character arrangement, and it has been regarded as a progress of a 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, which makes Python a language that is easy to use, easy to maintain, and popular and widely used by a large number of users. The program segments directly written in Python sometimes run more efficiently than programs written in C. The above is an introduction to the content related to the Python design concept. I hope you will gain some benefits.

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.