Python Learning (1) [Introduction to Python-What is Python]

Source: Internet
Author: User

Python isProgramming LanguageIts name comes from a comedy. Perhaps the people who initially designed the Python language did not expect that today python will be so widely used in industry and scientific research.


What is Python?(Reproduced from Primus)

Eric Raymond, the famous author of free softwareArticleIn "How To Be a hacker", python is listed as one of the four programming languages that hackers should learn, and it is recommended that people learn programming from Python. This is indeed a pertinent suggestion. python is one of the best choices for programming learners who have never learned programming or are not computer professional.

Python

I spent less than 20 minutes studying python for the first time. I stood in the bookstore and flipped through a book that taught beginners to learn python. Since then, I have been attracted by this magical language.

Perfect Combination of ease of use and speed

Python is a very easy-to-use language. Many beginners of Java will be confused by Java classpath, it took more than half a day to figure out that classpath had a wrong Hello world before it could run. This problem does not occur when python is used. It can be directly used if it is installed.

Python is a scripting language that can run directly after being written, saving the trouble of compiling links. For beginners who need more hands-on practices, there is no chance of errors. In addition, Python also has an interactive mode.Program, Even the editor can be saved, and you can press in to run it.

Python is a clear language. using indentation to express the nested relationship of a program is a pioneering task. It upgrades the soft programming style of the past to hard syntax. There is no need to choose between different styles or dispute over different styles. Unlike Perl, Python does not have any obscure abbreviations and does not need to remember the meanings of various strange symbols. A program written in python is easy to understand. This is the consensus of many people.

Python is an object-oriented language, but its object-oriented language does not emphasize concepts as C ++ does, but focuses more on practicality. It is not to make the language complex to reflect the complete support for the concept, but to make programmers enjoy the benefits of object-oriented with the simplest method, this is one of the reasons why Python attracts many supporters like Java and C.

Python is a language with rich functions. It has a powerful basic class library and a large number of third-party extensions, so that python programmers do not need to envy Java JDK. Python provides a rich set of basic functions for programmers, so that people do not need to write the program at the bottom layer.

Speaking of this, people usually use a worry: The scripting language is usually slow. The speed of running the script language is indeed slower, but the speed of python is much faster than people think.

Although python is a scripting language, it can also be compiled, just like compiling a Java program, to compile a python program into a special bytecode, the execution is bytecode, saving the analysis and interpretation of the program text, which naturally improves the speed.

In Java programming, people advocate a method of pure Java, except that everything on the virtual machine is written in Java. No matter the basic data structure or graphical interface, pure Java's swing, it has become a nightmare for countless Java application developers. Python advocates practicality. Its overall environment is written in C. Many basic functions and extended modules are written in C/C ++. When this part is executedCodeThe speed is the speed of C. The startup speed of a common desktop program written in python is not much different from that written in C.

In addition, some third-party software packages are written in Python.Source codeIt can also run in a JIT-like way, which can greatly improve the speed of Python code. for different types of code, the speed will be increased by 2 to 100 times.

Python is the most perfect combination of ease of use and speed in the languages I have seen. It achieves higher programming efficiency by losing a little bit of speed that is often negligible, this is why I chose python.

Focus on the problems to be solved

You can select a proper language to focus on the problems you need to solve. Different Languages have different functions. C and assembly are suitable for compiling system software. If they are used to compile enterprise applications, few may be able to use them. I used to come across a guy who used to write database programs. Although the most basic functions have been completed, he can't cope with the need to add a report preview or something. Smart programmers use suitable tools to complete their tasks. It is impossible to find a universal key.

Python's automatic garbage collection mechanism is a basic feature of advanced programming languages. Programmers generally do not have to worry about memory leaks when programming in languages with this function, when we use C/C ++ to write a program, this is one of the most important issues that require careful consideration but are prone to errors.

The data structure is an important part of the program composition. The linked list, tree, and diagram are much simpler in Python than they need to be carefully expressed when programming in C. In python, the most basic data structures are arrays, sequences, and hash tables. It is very easy to use them to express various common data structures. Programming becomes interesting without defining pointers and allocating memory tasks.

CORBA is an advanced software architecture that is independent of a language-independent platform. C ++, Java, and other languages all have CORBA bindings, but compared with them, Python's CORBA bindings are much easier, because in the programmer's opinion, there is no difference in the use and implementation of a CORBA class and a python class. Without the trouble of complicated architecture, it is also easy to write a CORBA program using python.

Good steel should be used in the cutting edge. If you want to complete as many tasks as possible with limited time, you must discard all kinds of irrelevant problems. Python just provides this method.

Cross-platform and scalable

As Linux continues to mature and more people turn to the Linux platform for work, software developers naturally want their own software to run on all platforms. The slogan of a Java program running everywhere makes it a model of cross-platform development tools, but its running speed is not favored by people. In fact, almost all famous scripting languages are cross-platform, and python is no exception. Python not only supports various Linux/Unix systems, but also supports running Python programs on Windows and even palm.

To work across platforms, a program requires not only the language itself to be compatible between platforms, but also widgets that can work across platforms in the era of graphical interfaces. Python not only supports older TK, but also supports new GTK +, QT, and wxWidgets. These widgets can work on multiple platforms. With these tools, programmers can write beautiful cross-platform GUI programs.

Python is usually run between native code and script code. programmers can use C/C ++ to write various modules for python, this not only allows programmers to use various system services in Python mode, but also excellent function libraries and class libraries written in C/C ++. It also greatly improves the speed of Python programs.

Writing Python modules in C/C ++ is not complicated. In order to simplify this work, many tools have been created to help. Because of this, various common function libraries and class libraries are bound to the Python language, and more things can be done with python.

Omnipotent key?

Python is powerful, but it is not omnipotent. If you want to write an operating system or driver, it is clear that python cannot. No tool is omnipotent for writing software. The reason why there are so many programming languages is that different languages are suitable for different things. Therefore, it is most important to select a language tool that suits you.

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.