An object, in Python, is a structure of data generated by the code in execution.
Until the objects are useful they are kept in memory. In practice, they will be deleted, through a mechanism called garbage collection, when there will be no labels (names) refferring to them.
The objects got type and identity (id) attribute.
Let's create an object that has a label "varname" and that is an int type
The label varname now refers to another object 500 of int type. The old object 33 does not have a label anymore, so python cannot use it anymore. The garbage collection mechanism will free the memory for this object then.
Until the objects are useful they are kept in memory. In practice, they will be deleted, through a mechanism called garbage collection, when there will be no labels (names) refferring to them.
The objects got type and identity (id) attribute.
Let's create an object that has a label "varname" and that is an int type
Now, if I give another value to varname
>>> varname = 500
Comments
Post a Comment