Python – Dynamic Programming Language

Python is Dynamic:

  • Every programming language is used to develop applications
  • Application is used to store and process the data.
  • Generally we allocate memory to variables in 2 ways
  • Static memory allocation
  • Dynamic memory allocation

Static memory:

  • Static means “fixed memory”
  • The languages which are supporting primitive types allowed allocating static memory.
  • Primitive variable size and type are fixed.
  • Primitive variable stores data directly.
  • Compiler raises error when data limit or type is deviated from specified.

Dynamic memory:

  • Python is dynamic.
  • Dynamic memory means type and size of data can vary.
  • Python can store information in Object format.
  • Dynamic variables cannot store the data directly.
  • Dynamic variables store the reference of Object which holds data.

In Python, object location changes every time when we modify the data.

>>> a=10
>>> print(a)
10
>>> print(“Address :”,id(a))
Address : 1628169120
 
>>> a=a+15
>>> print(a)
25
>>> print(“Address :”,id(a))
Address : 1628169360
 
>>> a=”python”
>>> print(a)
python
>>> print(“Address :”,id(a))
Address : 48576832
Scroll to Top