references and buffer()
km
srikrishnamohan at gmail.com
Sun Oct 8 15:58:45 EDT 2006
Hi all,
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
> Python.
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.
IOW
>
> a --> 10
> b -/
>
> Delete the 'a' reference and:
>
> b --> 10
got it!
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?
regards,
KM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20061009/444965b4/attachment.html>
More information about the Python-list
mailing list