Monday, 19 January 2015

response post: What is Self?

In my first post, I asked about how contents of an object is bundled together in the memory level in python. I have not found a concise answer but I tried the python visualizer (http://pythontutor.com/csc108h.html#mode=edit) with a code where I define a class and instantiate an object. The above code was executed. I highly recommend using it. It shows you step by step how it got there. But for lazy people, a copy of final result is shown:
you can see that the instance of Point p does not have the methods linked to it as attributes. This does not fully answer my original question fully, but provides more insight into how things are managed at the memory level by python.

Happy Exploring :)

1 comment: