Learn Before
Concept
Stack-Based Virtual Machine
The virtual machine used in CPython is stack-based, meaning that its operation relies on stack data structures. CPython uses three types of stacks:
- The call stack, which holds an entry, known as a frame, for every function call in the program. When a function call returns, it is popped off the call stack.
- An evaluation stack for each frame in the call stack, where function execution occurs. Executing code involves pushing objects to this stack, manipulating them, and popping them.
- The block stack, used to keep track of certain control structures like loops or try/except blocks.
0
1
Updated 2021-06-19
Tags
Python Programming Language
Data Science