Python 101 : Dynamically typed variables


Data in Python is built around the concept of object. In Python, if we write the below instruction:


We are defining a pointer named "x" that points to a memory location
that contains the value "2".
Python variables are just pointer to different objects, so we don't need to declare the them at the beginning of our programs.

A variable could point to different types of objects as we can see below:


Example:


The instruction "b=a" makes the variable "a" and "b" point to the same location.
If we change the value of "b" using the instruction "b=2", "b" will point to the location of the value "2", and "a" remain unchanged.

Comments

Popular posts from this blog

Istio 101 : How Istio ServiceEntry relates to Kubernetes Services and Endpoints

Kubernetes 101 : - Scaling a Stateful set -

Python 101 : Generators and Lists