Preparations for analyzing Python source code and analyzing python source code

Source: Internet
Author: User
Tags run python script

Preparations for analyzing Python source code and analyzing python source code

A Python developer is also a C language enthusiast. In order to enhance his understanding of the Python language implementation, I recently chose to read Chen Ru's book, read Python3.5.1 source code, and record the Reading Notes again.

I. Overall Python Structure

Python is divided into three parts: File Groups, Interpreter, and Runtim Environement ):

The file system is used to store Python script files (. py). It consists of built-in modules, third-party modules, and user-defined modules;

The interpreter is used to scan, parse, compile, and run Python script files. It consists of four parts: Parser, Parser, Complier, and Exauator;

1. Renewal
It is used for lexical parsing of Python scripts and divides scripts into tokens.

2. Parser
Parse all tokens to create an abstract syntax tree.

3. Complier

Create a command set (Python bytecode) based on the abstract syntax tree)

4. Exauator

Run Python bytecode

 Ii. runtime environment mainly includes Object/type system, memory distributor, and runtime status information

1. Object/Type System

Contains all built-in Python objects, user-defined types, and objects

2. Memory distributor
Maintains the memory application for Python object creation.

3. Running status information
Maintenance interpreter switches between different statuses during bytecode execution

Iii. Overall Structure:

 

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.