references and buffer()

km srikrishnamohan at
Sun Oct 8 20:40:40 CEST 2006

Hi all,

was looking at references  in python...
>>> a = 10
>>> b = a
 >>> id(a)

where a and b point to the same id. now is this id an address ?
can one dereference a value based on address alone in python?
is id similar to the address of a variable or a class ?

read abt buffers as a refernce to a buffer object.
actually i tried passing list and dict types to buffer function, but only
with string type i could createa buffer reference,
>>>y = 'GATCGTACC'
>>>x = buffer(y, 0,8)
>>> x
<read-only buffer for 0xbf4cd3b8, size 8, offset 2 at 0xbf4cf0e0>
>>>print x
>>> id(y)
>>> id(x)

now the ids of y and x are not the same - why ?
In which situatons are buffers used against the strings ?
can i create a write buffer instead of readonly buffer ?
what exactly are buffer object types ? and how can i instantiate them ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list