Skip to content

Latest commit

 

History

History
14 lines (8 loc) · 541 Bytes

locations_or_names.md

File metadata and controls

14 lines (8 loc) · 541 Bytes

Locations or Names

Objective

What do you think about the following statement:

In Python, variables are locations, not just names. So x = 1 is really the value of 1 in the memory location called x.

Solution

The statement above is wrong. In Python a variable is merely a name, a reference to the object, not the actual object. So when for example you perform an assignment, you don't copy the value into the variable, but you assign the object with a name.

So in case of x = 1 what it means, is x refers to the integer 1.