How to call Python correctly

Source: Internet
Author: User

Python is an object-oriented, explanatory computer programming language. It is also a powerful and complete general-purpose language and has been developed for more than a decade. It is mature and stable, the following describes how to call Python.

This language is very simple and clear syntax, suitable for completing a variety of high-level tasks, almost all operating systems can run. At present, technologies based on this language are rapidly developing, the number of users is rapidly expanding, and there are a lot of related resources.

The following is a simple program that outputs Hello World on a standard output device. This program is usually the first program to start learning programming languages:

 
 
  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 founder of Python is Guido van rosum. In Amsterdam during the Christmas Day of 1989, Guido was determined to develop a new script interpreter to ease Christmas. As an inheritance of the ABC language. Select the meaning of Python) as the program name.

He is a fan of Monty Python flying circus. ABC is a teaching language designed by Guido. In Guido's opinion, ABC is a very elegant and powerful language designed specifically for non-professional programmers.

However, the ABC language is not successful. The reason is that Guido believes that it is not open. Guido is determined to avoid this error in Python. It is true that Python is well integrated with other languages such as C, C ++ and Java ). At the same time, he also wants to implement things that flash in ABC but have never been implemented. Although Python may be roughly classified as "script language scripting language)", it is widely used in some large-scale software development plans, such as Zope, Mnet, and BitTorrent. Google.

Python fans prefer to call it a high-order dynamic programming language because "scripting language" generally refers to a single use of simple programming tasks such as shell scripts, python cannot be compared with programming languages such as JavaScript that can only process simple tasks.

  • How to correctly design Python?
  • Full parsing of Python 2.0 XML Problems
  • Exploring a variety of Python languages
  • C ++ basic application guide for calling python script Functions
  • How to Use Python normally

Scalability is a feature of Python as a programming language. New built-in module) can be written in C or C ++. 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:

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 authors intentionally design highly restrictive syntaxes to make 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 called by Python.

Although Python is a very successful language, it is also necessary to understand its limitations.

1. Low Running Efficiency so far, Python is the slowest among all mainstream scripting languages. (Is that true? To be tested.) This is related to the script engine design philosophy. If your application requires a high speed, consider whether Python can meet your needs. However, you can use C to write key modules and then use Python to call them.

2. Multithread support is poor. Python supports multithreading, but its running efficiency is not high.

3. The unique syntax may not be called a limitation, but it uses indentation to differentiate the relationship between statements, which still brings confusion to many beginners. Even experienced Python programmers may fall into a trap. The most common case is that the combination of tabs and spaces will lead to errors, which cannot be separated by the naked eye.

4. As a Dynamic Language, The classless language creates and uses variables anytime and anywhere, which is a great convenience for Python. But it also makes the program not rigorous, and some errors may only occur during running. Therefore, you should be aware of the type when using Python programming. This also makes the IDE tool called by Python unable to provide convenient functions such as automatic completion.

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.