Self hosting Python? (was: Python is just as good as C++ for real apps)
Gustavo Córdova Avila
gcordova at sismex.com
Thu Jan 24 10:08:59 EST 2002
>
> Gustavo Córdova Avila <gcordova at sismex.com> wrote in message
> news:<mailman.1011833199.21292.python-list at python.org>...
> > p = Memory.BytePointer()
> > dict = { lotsa stuff }
> > # Assign to "p" the address in memory of dict.
> > p = dict
>
> That last statement isn't doing what you think it is doing.
> An assignment wipes out the history of a variable, so after
> the snippet above, p and dict are the same dictionary, both
> have type "dict", and the first statement has NO effect on
> the current state of p. To create a pointer type, you would
> need something like:
>
> import Memory
> D = {"eggs": "spam"}
> ptrToD = Memory.AddrOf(D)
>
Damn! My C++ roots are showing. :P
I forgot that you can't redefine "=".
But you got the drift :)
-gus
More information about the Python-list
mailing list