Memory Allocation For Variables in Python 3
Memory Allocation For Variables in Python 3
Python 3
BY: A.K.V.S CHAKRAVARTHY
BRANCH: INFORMATION TECHNOLOGY
ROLL.NO: 22891A1201
AGENDA
Introduction Memory
Prerequisites Conclusion
to variables Management
Introduction to variables
what is the need of variables?
Variables are a fundamental component of programming languages.
When working with a programming language, we often need to retrieve
and store data. This data resides in system memory locations, each of
which has a specific hexadecimal address. To manipulate this data, it's
necessary to know the memory address of each system memory
location, which can be a challenging task. Therefore, we assign
temporary names to these system memory locations, and these names
are known as variables.
Prerequisites
Before diving into the subject let us discuss few prerequisites.
Object in Memory Management:
• In Python, everything is an object. An object is a unit of data in memory that holds both a
value (the data itself) and information about its type.
• Objects can represent various types of data, such as numbers, strings, lists, functions, and
even custom-defined types.
• Objects are units of data in memory that hold values and have types.
• Here I insist don’t get confused between the object concept in OOP’s and memory
management.
Memory Management
The actual story begins
In python when you declare and OBJECT
Type Int
Here the type of the value assigned to the
variable will be the type of the object >>> a = 26
Value 26
ID: 22e896
Now, after the creation of this
object in system memory, the a
OBJECT
memory address or id will be 22e896
Type Int
assigned to the variable to which Value 26