Re: references and buffer()

2006-10-08 Thread Fredrik Lundh
km wrote: > why is that python doesnt implement direct memory addressing provided a > reference to an object exists ? because Python is a portable high-level language. if you want assembler, you shouldn't use Python. did you read the "reset your brain" article ? -- http://mail.python.org/

Re: references and buffer()

2006-10-08 Thread km
Hi all, Congratulations, you understand both Hinduism and Python better than Ido now.  :) c.f.http://www.swami-krishnananda.org/brdup/brhad_III-09.html"Kati references, Yajnavalkya, iti?"  the answer lies in a single line as pronounced by sri adi sankaracharya - "aham bramhasmi sivoha sivoham "

Re: references and buffer()

2006-10-08 Thread Theerasak Photha
On 10/8/06, km <[EMAIL PROTECTED]> wrote: > 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

Re: references and buffer()

2006-10-08 Thread km
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. Notmuch of a difference; I haven't seen buffer objects yet (I am also newto Python), but the initialization for the buffer probably copieswhatever is in y somew

Re: references and buffer()

2006-10-08 Thread Steve Holden
km wrote: > 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

Re: references and buffer()

2006-10-08 Thread Theerasak Photha
On 10/8/06, km <[EMAIL PROTECTED]> wrote: > 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

Re: references and buffer()

2006-10-08 Thread Fredrik Lundh
km wrote: > ok so can i point a vairiable to an address location just as done in C > language ? no. there are no C-style "variables" in Python; just objects and names bound to objects. Python variables are names, not memory locations. > >>> y = 'ATGCATGC' > >>> x = buffer(y) > >>> del(y)

Re: references and buffer()

2006-10-08 Thread Carl Friedrich Bolz
Fredrik Lundh wrote: [snip] >> is id similar to the address of a variable or a class ? > > in the CPython implementation, it's the address where the object is > stored. but that's an implementation detail. Just as an obscure sidenote, in PyPy it is ~address some of the time. This is due to the fa

Re: references and buffer()

2006-10-08 Thread km
Hi all, in the CPython implementation, it's the address where the object isstored.  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 >>> print x ATGCATGC now even when i

Re: references and buffer()

2006-10-08 Thread Theerasak Photha
On 10/8/06, km <[EMAIL PROTECTED]> wrote: > > Hi all, > > was looking at references in python... > >>> a = 10 > >>> b = a > >>> id(a) > 153918788 > >>>id(b) > 153918788 > > where a and b point to the same id. now is this id an address ? The id may be considered similar to an address in

Re: references and buffer()

2006-10-08 Thread Fredrik Lundh
km wrote: > > Hi all, > > was looking at references in python... > >>> a = 10 > >>> b = a > >>> id(a) > 153918788 > >>>id(b) > 153918788 > > where a and b point to the same id. now is this id an address ? no, it's the object identity, and all it tells you is that both names point to the s

references and buffer()

2006-10-08 Thread km
Hi all, was looking at references  in python... >>> a = 10 >>> b = a  >>> id(a) 153918788 >>>id(b) 153918788 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 ? re