Answer the question
In order to leave comments, you need to log in
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question