+ 2
Multiple Memory Addresses ???
Run this simple two line code 5 or 6 times >> https://code.sololearn.com/cuDI6MNJR7Av/#py ... and you will notice that the memory address switches between two and sometimes three different values. - What does this tell me about Sololearn's browser based IDE? - Is it something I need to worry about? - Is there a way to prevent it from happening? Thanks
3 Respuestas
+ 7
Data is constantly moved around. And since different instances are made of the same object everytime you run the application, it can change.
+ 2
print(id(a)) for multiple times within the same program and you'll see that the memory address remains the same.
It's normal that when you start the program again "a" will not be in the same memory address where it was stored by the previous program.
I doesn't tell much about SL IDE
It is not something to worry about
There is no way you can change it
+ 1
+1 to both SoraKatadzuma and seamiki
@ seamiki - What you say is not entirely true as the address also seems to change within the same running of a program...
... as in this example I made >> https://code.sololearn.com/cg32xkR0E49X/#py
... you can see that the address switches even between iterations of a loop during a single running of a program.
One more question? - Does this memory address switching happen with all programming languages, or is it just Python? Also, is this switching designed to 'reduce memory use' or 'speed things up' or both?