Topics

Wednesday, 26 June 2019

Object Reference

A Python program accesses data values through references. A reference is a name that refers to the specific location in memory of a value (object).

Python doesn't have variables as such but instead has object-reference. When it comes to immutable objects like strs (String data type), there is no discernable (noticeable) difference between a variable and an object reference. As for mutable objects, there is a difference, but it rarely matters in practice.
We will use the terms variable and object reference interchangeably.

An object reference is nothing more than a concrete representation of the object’s identity (the memory address where the object is stored).

References take the form of variables, attributes, and items. In Python, a variable or other reference has no built-in data type.





No comments:

Post a Comment