B
B
Ben_r0072021-06-13 13:22:18
Python
Ben_r007, 2021-06-13 13:22:18

How does writing variables to memory work in Python?

Hello.
I started digging into how variables work in Python and was amazed.
Until now, I've thought that variables in Python work just like they do in statically typed compiled languages.
An-no!
>>> name = "John"
>>> hex(id(name))
'0x28632eb17b0'
>>> name = "Constantine"
>>> hex(id(name))
'0x28632eb3af0
' cell in memory, but it somehow diverges.
Later I learned that through id we get the address of a unique object. Is it an address in RAM?
Now I have absolutely no idea how variables work in Python.
Please help me figure it out!
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
HemulGM, 2021-06-13
@Ben_r007

No, it's not. This is an internal address. Shows the location in one of the python memory tables
Read here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question