references and buffer()

km srikrishnamohan at gmail.com
Sun Oct 8 15:09:24 EDT 2006


Hi all,

in the CPython implementation, it's the address where the object is
> stored.  but that's an implementation detail.


 ok so can i point a vairiable to an address location just as done in C
language ?
>>> y = 'ATGCATGC'
>>> x = buffer(y)
>>> del(y)
>>> x
<read-only buffer for 0xbf4cf0e0, size -1, offset 0 at 0xbf4cf240>
>>> print x
ATGCATGC

now even when i delete y,  why is that x still exists ?
thats true even in the case of vairable assignment which states it a a
reference !
>>> a = 10
>>> b = a
>>> del(a)
>>> b
10
i always thought if u modify the referred variable/buffer object it should
be reflected in the referenced variables/buffers objects . am i wrong ?
does it mean that references  in python are not true references ?

regards,
KM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20061009/b9c2c470/attachment.html>


More information about the Python-list mailing list