Where are variables stored in Python?

In C ++, local variables are stored on the stack, and data created by the new statement is stored on the heap. So what about variables in Python? Where are they stored?

+6
source share
1 answer

Copy from Python Documentation :

Python memory management includes a heap containing all Python objects and data structures. This private heap is managed by the Python internal memory manager. The Python memory manager has various components that deal with various aspects of managing dynamic storage, such as sharing, segmentation, pre-allocation, or caching.

+5
source

Source: https://habr.com/ru/post/949902/


All Articles