Memory addressing

Simon Berube sberub at gmail.com
Fri Apr 27 15:56:43 EDT 2007


On Apr 27, 3:52 pm, Carsten Haese <cars... at uniqsys.com> wrote:
> On Fri, 2007-04-27 at 12:41 -0700, Simon Berube wrote:
> > Hi,
>
> >    I have a rather simple question for which I couldn't find an
> > answer. I noticed how a significant number of objects in Python return
> > a __repr__() string along the lines of :
>
> > < Object at 0xXXXXXX>
>
> >    I find this notation quite convenient to avoid out of control
> > strings when using large arrays but I was wondering how you can use
> > the memory address for assigning a new object.
>
> You can't.
>
> > In c, one could simple have a pointer to that memory address and
> > voila, you have a new object you can analyze however it seems like
> > python is allergic to direct memory manipulation.
>
> For good reason. Python is not C.
>
> > Hence, I was wondering what is the correct way to go about obtaining
> > objects returned in such a fashion? What am I going wrong or what am I
> > not getting?
>
> What is the actual problem you're trying to solve?
>
> -Carsten

First of all, thanks for your reply. I am not trying to solve a
problem in particular, I know that my way of thinking of very wrong in
a python sense and I am simply trying to find the equivalent accepted
practice.

When you call certain objects __repr__() strings in python you often
get the : <Object at Memory Address> happen. I am simply trying to
understand how that information can be used to recreate a certain
object that failed as per the given purpose of the __repr__()
functions.

In short, how do I used <Object at Memory Address> strings to recreate
a an object.

I hope this is clearer.





More information about the Python-list mailing list