The variable is not the object
Here “a” is a variable that points to a list containing the elements “X” and “Y”. But “a” itself is not a list. Consider “a” to be a bucket that contains the object “X” and “Y”.
a = ["X", "Y"]
Pass by reference vs value in Python
Developers jumping into Python programming from other languages like C++ and Java are often confused by the process of passing arguments in Python. The object-centric data model and its treatment of assignment are the causes of the confusion at the fundamental level.
In the article, we will be discussing the concept of how to pass a value by reference in Python and try to understand pass-by-reference examples in Python.
Table of Content
- Pass by Value and Pass by Reference in Python
- The variable is not the object
- What is Pass by Reference In Python?
- What is Pass by Value In Python?