⚠️ Your Chrome browser version is too low. For access security, we recommend upgrade now In case of problems, please go to here Feedback.
 Python source code analysis

Python source code analysis

Deeply explore the core technology of dynamic language

nine point four 92 people
eight point eight 827 Evaluation Douban Reading
¥38.39

Introduction

As a mainstream dynamic language, Python is not only easy to learn and transplantable, but also has strong and rich library support. In addition, The powerful extensibility of Python makes it very easy for developers to use C/C++to write Python extension modules, and also to embed Python into C/C++programs to add the ability of dynamic expansion and dynamic programming to their own systems.

In order to make better use of the Python language, it is very important to have a deep understanding of the operating principle of Python, whether you use the Python language itself or use Python interactively with C/C++. This book takes CPython as the research object, and analyzes the implementation of Python in depth and detail at the C code level. The book not only includes the analysis of a large number of Python built-in objects, but also devotes a large amount of space to the analysis of Python virtual machines and Python advanced features. Through this book, readers can thoroughly understand the operating principles of core technologies in Python, such as general expressions, control structures, exception mechanisms, class mechanisms, multithreading mechanisms, dynamic loading mechanisms of modules, memory management mechanisms, etc. At the same time, the core technologies of dynamic languages revealed in this book are useful for understanding other dynamic languages, such as Javascript Ruby is also of great reference value.

This book is suitable for Python programmers, dynamic language enthusiasts C programmers read.

Chen Ru, Master of Computer Science and Engineering, Technical Director of Wentian (Beijing) Information Technology Co., Ltd., is committed to the research and development of information retrieval.

Catalogue of works

  1. Chapter 0 Python Source Code Analysis -- Compiling Python
  2. 0.1 Python overall architecture
  3. 0.2 Python source code organization
  4. 0.3 Compiling Python in Windows
  5. 0.4 Compiling Python in Unix/Linux
  6. 0.5 Modify Python source code
  7. 0.6 The road to Python
  8. 0.7 Some precautions
  9. Part 1 Python Built in Objects
  10. Chapter 1 Preliminary Exploration of Python Objects
  11. 1.1 Objects in Python
  12. 1.2 Type objects
  13. 1.3 Polymorphism of Python objects
  14. 1.4 Reference counting
  15. 1.5 Classification of Python objects
  16. Chapter 2 Integer Objects in Python
  17. 2.1 Getting to know PyIntObject objects
  18. 2.2 Creation and maintenance of PyIntObject objects
  19. 2.3 Hack PyIntObject
  20. Chapter 3 String Objects in Python
  21. 3.1 PyStringObject and PyString_Type
  22. 3.2 Creating PyStringObject Objects
  23. 3.3 Inter mechanism of string objects
  24. 3.4 Character buffer pool
  25. 3.5 PyStringObject efficiency related issues
  26. 3.6 Hack PyStringObject
  27. Chapter 4 List Objects in Python
  28. 4.1 PyListObject object
  29. 4.2 Creation and Maintenance of PyListObject Object
  30. 4.3 PyListObject Object Buffer Pool
  31. 4.4 Hack PyListObject
  32. Chapter 5 Dict Objects in Python
  33. 5.1 Overview of hash table
  34. 5.2 PyDictObject
  35. 5.3 Creation and maintenance of PyDictObject
  36. 5.4 PyDictObject Object Buffer Pool
  37. 5.5 Hack PyDictObject
  38. Chapter 6 The simplest Python simulation - Small Python
  39. 6.1 Small Python
  40. 6.2 Object mechanism
  41. 6.3 Interpretation process
  42. 6.4 Interactive environment
  43. Part 2 Python Virtual Machine
  44. Chapter 7 Python Compilation Results - Code Object and Pyc File
  45. 7.1 Execution process of Python program
  46. 7.2 Compilation result of Python compiler -- PyCodeObject object
  47. 7.3 Generation of Pyc files
  48. 7.4 Python bytecode
  49. 7.5 Parsing pyc files
  50. Chapter 8 Python Virtual Machine Framework
  51. 8.1 Execution environment in Python virtual machine
  52. 8.2 Name, Scope and Namespace
  53. 8.3 Running framework of Python virtual machine
  54. 8.4 Python runtime environment
  55. Chapter 9 General Expression in Python Virtual Machine
  56. 9.1 Creation of simple built-in objects
  57. 9.2 Creation of Complex Built in Objects
  58. 9.3 Other general expressions
  59. Chapter 10 Control Flow in Python Virtual Machine
  60. 10.1 If control flow in Python virtual machine
  61. 10.2 For loop control flow in Python virtual machine
  62. 10.3 While loop control structure in Python virtual machine
  63. 10.4 Exception control flow in Python virtual machine
  64. Chapter 11 Function Mechanism in Python Virtual Machine
  65. 11.1 PyFunctionObject object
  66. 11.2 Function call without parameters
  67. 11.3 Namespace during function execution
  68. 11.4 Implementation of function parameters
  69. 11.5 Access to local variables in functions
  70. 11.6 Nested functions, closures, and decorators
  71. Chapter 12 Class Mechanism in Python Virtual Machine
  72. 12.1 Object model in Python
  73. 12.2 From type object to class object
  74. 12.3 User defined class
  75. 12.4 From class object to instance object
  76. 12.5 Accessing the attributes in the instance object
  77. 12.6 The ever-changing descriptor
  78. Chapter 13 Initialization of Python Running Environment
  79. 13.1 Thread Environment Initialization
  80. 13.2 Initialization of system module
  81. 13.3 Activate Python virtual machine
  82. Chapter 14 Dynamic Loading Mechanism of Python Modules
  83. 14.1 Prelude to import
  84. 14.2 Black box detection of import mechanism in Python
  85. 14.3 Implementation of import mechanism
  86. 14.4 Import operation in Python
  87. 14.5 Module related namespaces
  88. Chapter 15 Python multithreading mechanism
  89. 15.1 GIL and thread scheduling
  90. 15.2 See Python Thread for the first time
  91. 15.3 Creation of Python thread
  92. 15.4 Scheduling of Python threads
  93. 15.5 Destruction of Python sub threads
  94. 15.6 User level mutual exclusion and synchronization of Python threads
  95. 15.7 Advanced thread library - threading
  96. Chapter 16 Python Memory Management Mechanism
  97. 16.1 Memory management architecture
  98. 16.2 Memory pool of small space
  99. 16.3 Recycling garbage collection
  100. 16.4 Garbage collection in Python
Loading

Everyone likes it