references and buffer()
srikrishnamohan at gmail.com
Sun Oct 8 21:58:45 CEST 2006
Say that you copy the contents of file foo into file bar and delete
> the original foo. Of course file bar still exists in this case. Not
> much of a difference; I haven't seen buffer objects yet (I am also new
> to Python), but the initialization for the buffer probably copies
> whatever is in y somewhere.
that means when u refer to an object with different names (variable), it
referes to the same object- fine. but is it that the original object stays
in memory until it is Garbage Collected ?
is it that del() deletes the link of variable to the object and not the
object ? and thats why u can access it from other variables ?
You didn't modify the object that the variable /refers to/.
> Furthermore, numbers are immutable anyway. To continue with the Hindu
> god analogy, Vishnu did not cease to exist when any of his avatars
> passed from the physical world; it is no different with objects in
vishnu analogy is a bit complicated as it is a manifestation of divine
energy in terms of earthly object(avatar). Its clearly not a reference. each
avatar is himself (vishnu). It is the same energy people around have too
(coz of manifestation). ofcourse they dont realise coz of ego (id in
python) and so the object class (divine energy) is the same - unlike python
where we have different classes derived from object class.
> a --> 10
> b -/
> Delete the 'a' reference and:
> b --> 10
What is a little different is this: if there are no references left to
> an object (such as variables), the object the references point to will
> eventually be deleted. Variables are one way to have a reference to an
> object. References to an object may also exist in a list, hash, or
> other data type.
so the object exists until there are no references to it and will be
Garbage Collected immediately?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list