When you have two variables referring to the same object, the return values of the id()
function must be the same.
Run the code presented in the right pane to confirm our speculations:
a_string identity: 8466704
b_string identity: 8466704
output
In this example, we haven’t created a new list, but just created a new label that references the already created list.
This interesting behavior will be examined on the following pages.