Python Forum

Full Version: Data placement
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I was just wondering if 'Declaring variables' close to each other in Python scripts results in their memory location being close to each other in RAM i.e. is this an easy way to speed up Python code?

Many thanks
(May-16-2020, 10:18 AM)nboogerz Wrote: [ -> ]Hi,

I was just wondering if 'Declaring variables' close to each other in Python scripts results in their memory location being close to each other in RAM i.e. is this an easy way to speed up Python code?
Do not need to declare variables before using them in Python.
Can not choice memory location of an object in Python.
Memory Management
Memory management in Python Wrote:It is important to understand that the management of the Python heap is performed by the interpreter itself and that the user has no control over it,
even if they regularly manipulate object pointers to memory blocks inside that heap.
The allocation of heap space for Python objects and other internal buffers is performed on demand by the Python memory manager through the Python/C API functions listed in this document.

There are many different ways speed up Python code if that's needed,just not the way you think of with memory location.