Pointers
Kragen Sitaker
kragen at dnaco.net
Wed Mar 15 22:13:23 EST 2000
In article <38D00DCE.9740380F at be-research.ucsd.edu>,
Curtis Jensen <cjensen at be-research.ucsd.edu> wrote:
>I haven't found anything about pointers in python. Is there a pointer
>type? If so, what is the syntax?
All Python variables are pointers.
a = 2
b = 3
# now a is a pointer to the integer object 2, and b is a pointer to the
# integer object 3.
a = a + b
# now we have added what a points to and what b points to; the result is 5.
# So an integer object 5 is created. a gets pointed to it. Nothing points
# to the 2 object any more, so it gets destroyed.
# (Actually, that's a lie; integers are handled a little bit oddly. Small
# integers are created early and are immortal.)
# (It may be that all of this is a lie; it's just what I've gathered from
# reading the newsgroup; I haven't read the source yet. Surely someone
# will correct me if I am wrong.)
--
<kragen at pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08. Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
The power didn't go out on 2000-01-01 either. :)
More information about the Python-list
mailing list