When compiling Python source code, we may all know some of its actual application solutions and related functions. But do you know how to perform operations in the Python source code organization process? If you have this idea, click the following article.
Python source code Organization
To analyze the Python source code, you must first obtain the Python source code. The latest version of Python is 2.4.2. In this book, I use Python2.4.1:
Download and decompress the Python source code package,
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.
- Use the Python GUI program to "Disable" the output of the command line window
- Python specific application in Zope Software Development
- Advantages of the Python Programming Language
- How to efficiently complete the work in the Python Library
- Use the Python programming language design philosophy to solve the disadvantages of Programming
Lib: This directory contains all the standard libraries that come with Python. Libraries in Lib are written in Python.
Modules: this folder contains all Modules written in C language, such as ramdom and cStringIO. The Modules in Modules are those with strict speed requirements. Some modules that do not have strict speed requirements, such as OS, are written in Python and placed in the Lib directory.
Parser: the Parser directory contains the Parser and Parser sections in the Python interpreter, that is, the lexical analysis and syntax analysis of the Python source code. In addition, the Parser directory contains some useful tools that can automatically generate the lexical and syntax analyzer of the Python language based on the syntax of the Python language, which is very similar to YACC.
Objects: This directory contains all Python built-in Objects, including integers, lists, and dict, this directory also includes the implementation of all internal use objects required by Python during runtime.
Python: This directory contains Compiler and execution engine in the Python interpreter, which is the core of Python running.
PCBuild: contains the Visual Studio 2003 project file. It starts from studying the Python source code.
Compile Python
Now, after downloading the Python source code, we can go through the first step of analyzing the Python source code -- compiling Python :)
Python2.4.1 was developed in the Visual Studio 2003 environment. In the PCBuild directory, you can see the VS2003 project file. After opening the project, you need to make some settings to compile it successfully.
First, we need to activate the configuration dialog box of VS2003:
In the configuration dialog box, you must change the Startup Project. In Python2.4.1, _ bsddb is set by default. We need to change it to Python.
The above content mainly introduces the compilation of Python source code.