Three main structures of Python source code Architecture

Source: Internet
Author: User

At the highest level, the overall Python architecture can be divided into three main parts ,. Source code. Python source code provides a large number of modules, libraries, and user-defined modules. For example, when you execute import OS, This OS is a built-in Python module. Of course, you can also use custom modules to expand the Python system. In this series of articles, we will not examine this part too much.

Python source code

1. Overall Python Architecture
At the highest level, the overall Python architecture can be divided into four main parts ,. Source code. Python source code provides a large number of modules, libraries, and user-defined modules. For example, when you execute import OS, This OS is a built-in Python module. Of course, you can also use custom modules to expand the Python system. In this series of articles, we will not examine this part too much.

On the right side of the figure is the Python runtime environment, including the Object/Type System (Object/Type structures) and Memory distributor Memory Allocator) and the runtime status Current State of Python ). The runtime status maintains the interpreter's switching between different statuses when executing bytecode. we can regard it as a huge and complex finite state machine. The memory distributor is solely responsible for applying for memory when creating an object in Python. In fact, it is an interface layer between the Python runtime and the malloc in C. The object/type system contains various built-in objects in Python, such as integers, lists, and dict.

2 Python source code OrganizationThere is an old saying in China that it is hard for us to have no rice. To analyze the Python source code, you must first obtain the Python source code. Include: This directory contains all the header files provided by Python. If you need to write custom module extension Python using C or C ++, you need to use the header files provided here.

Lib: This directory contains all the standard libraries that come with Python. Libraries in Lib are written in Python.

  • Introduction to Python script in VIM
  • How to Use python to process text in vim
  • Application manual of Python array in List
  • Python string processing with flexibility as its biggest advantage
  • Python functions need to be constantly learned and improved

3. Compile Python

First, we need to activate the configuration dialog box of VS2003.

In the configuration dialog box, the first thing to do is to change the Startup Project. In Python2.4.1, _ bsddb is set by default. We need to change it to the Python source code.

Since we only analyzed the core part of Python and won't involve some standard libraries and other modules in the project, we need to delete them from the compiled list. After you click "Configuration Properties" in the list box on the left of the Configuration dialog box, the Child Project that is configured to be compiled is displayed. The redundant Child Project is deselected and only the python core and python source code are retained. .

Now, compile again, and everything will be done smoothly.

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.