Using pointers

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Sat Jul 20 09:56:44 EDT 2002


----- Original Message ----- 
From: "Joe Krahn" <jkrahn at nc.rr.com>


> Can I make a pointer to an object in Python? I know that all
> objects/variables are references, but not in the same sense as in C.
> How do I get multiple pointers to reference and modify one variable?

Let's frame this in C terms.  You want this:

    int *i, *j;
    int num;

    i = #
    j = #

    num = 11;

    printf("%d\n", *i);  /* should print 11, right? */

Assuming I have this right... you can't do it in Python.
Scalar types can't be handled that way.

Sorry.

Why don't you tell us a bit about what you are trying to 
accomplish, and then we can tell you the Pythonic approach.


Chris Gonnerman -- chris.gonnerman at newcenturycomputers.net
http://newcenturycomputers.net






More information about the Python-list mailing list