September 2026
1051 pages
35h 4m
English
This chapter describes how Python manages data at runtime. In particular, we will discuss what variables actually are in Python and explain the related terms object, instance, and reference.
In computer science, variables are generally understood as named storage locations for data of different types, such as numbers, lists, or other structures. As you already know, in Python a new variable named a can be created as follows:
>>> a = 1337
Subsequently, the variable a can be used like the numerical value 1337:
>>> 2674 / a2.0
To understand what happens internally when we create a new variable, two concepts need to be distinguished: instance and reference. An instance is a concrete data object in the memory created according to the ...
Read now
Unlock full access