Advantages of the Python application language

Source: Internet
Author: User

In the Python application language, the most important thing is readability. Good code will give people a fresh and beautiful feeling. The program is distributed in the form of modules and packages, and the version is highly controllable; the bytecode compiled by Python is platform-independent.

Garbage collection, hereinafter referred to as GC) in the current version, the reference counting garbage collection and the optional cyclic structure garbage space scanning technology are used. Once the object becomes inaccessible, it will be recycled, but it cannot be guaranteed to recycle the memory garbage that contains the cyclic reference count. The reference counting algorithm is intuitive: records the number of pointers to each bucket;

When you perform operations on a storage slice, update the reference count. When a storage slice is allocated, the reference count is initialized to 1. As long as the reference of the storage slice is copied, the reference count is increased by 1, when a bucket is deleted, the reference count is reduced by 1. If the reference count is reduced to 0.

The storage is recycled due to inaccessibility. Obviously, the counting algorithm cannot recycle the circular data structure. Imagine a simple scenario: a member of object a points to object B. At the same time, B also has a member pointing to a, and the code only references part of a. object B is generated only by assisting object a. If object a is deleted later.

As a whole, both a and B become memory spam. In theory, they should all be deleted by the memory manager. However, since the reference to the counting algorithm only examines one node at a time, therefore, the cyclic data structure cannot be recycled. Therefore, we should try to avoid loop references during programming. The execution efficiency of Python is slightly inferior to that of C/C ++/Java, but the code length is greatly shortened. In addition, Python supports a wide range of platforms, libraries, simple syntax, and fast development.

Therefore, the Python application language is often used to build large programs instead of C/Java. The C/C ++ implementation can be considered in terms of system efficiency. In addition, Python can also be used as the glue language), because Python can communicate well with C and Java.

Comparison of the three major scripting languages: Perl Python Tcl Perl was originally designed to process text, which is the most powerful, but not suitable for writing large programs, with obscure syntax, python is easier to read. Learning, more maintainability, better code security, Python exception handling), and better integration with the Java language; Tcl syntax is simple.

Strong interaction ability with other programs, can be integrated with C language, and tk assists in GUI development, but Tcl is mostly used as scripting language and glue language, and is not suitable for writing large programs, compared with Python, Python has a wide range of applications.

  • Analysis on Python virtual machine execution framework
  • Introduction to the Python runtime environment in the Python Virtual Machine
  • Introduction to simple and quick Python development tools
  • In-depth description of the process of destroying sub-threads in the main Python thread
  • Detailed explanation of Python thread application operations

Ruby: Regular Expressions in Python are not convenient to use in Ruby. Ruby has a more complete object-oriented syntax than Python. The main functions of Ruby are implemented through class method calls. It is not a function; on the other hand, because Ruby is powerful, the language is relatively complicated, Ruby is not introspection, lack of international support, and lack something similar to Jython.

The excellent features of the Python application language determine its extensiveness in practical application. Rapid Prototyping; web server scripts; scientific computing; document processing; database programming; embedded development; GUI development; game development; mobile development ...... python has powerful support for the Python community, a wide range of class libraries, and C/C ++/Java and other languages to provide extensible modules.

  1. Introduction to Python system files
  2. How to correctly use Python Functions
  3. Detailed introduction and analysis of Python build tools
  4. Advantages of Python in PythonAndroid
  5. How to Use the Python module to parse the configuration file?

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.