Re: Pointers in Python

2010-04-27 Thread Bruno Desthuilliers
Anton Shishkov a écrit : Hi, I can't figure out how can I change the variable type in function. In C I could do that easily by changing pointer. (snip) Others already answered on this. Now, the real question is : why to you want to do such a thing ? Of one the most common use case for this

Re: Pointers in Python

2010-04-27 Thread Laszlo Nagy
Hi, I can't figure out how can I change the variable type in function. In C I could do that easily by changing pointer. Please read about "mutable and immutable objects in Python". If you understand the difference between them, you will get the idea. I'll explain program anyway, showing you

Re: Pointers in Python

2010-04-27 Thread Chris Rebert
On Tue, Apr 27, 2010 at 6:09 AM, Anton Shishkov wrote: > Hi, I can't figure out how can I change the variable type in function. > In C I could do that easily by changing pointer. > > Code: > def add(b): > >    b = {} >    print type(b) > > a = [] > print type(a) > add(a) > print type(a) > > Output

Pointers in Python

2010-04-27 Thread Anton Shishkov
Hi, I can't figure out how can I change the variable type in function. In C I could do that easily by changing pointer. Code: def add(b): b = {} print type(b) a = [] print type(a) add(a) print type(a) Output: -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows memory pointers in Python?

2005-10-12 Thread Gregory Piñero
Well, I think I've got it after a bit of research: c_char_p(address) seems to do the trick.  Thus it would be: ctypes.c_char_p(address) Of course  still let me know if this is somehow WRONG, or if there is a better way, but this seems good.  Thanks again ctypes!  http://starship.python.net/crew/t

Windows memory pointers in Python?

2005-10-12 Thread Gregory Piñero
Hi guys, I'm really lost of on this one.  How can I turn this (VB?) code into Python?  Basically I call a function exposed from a dll and it returns me what I believe is a pointer to a location in memory?  Now I need to read that area to get the string I need.  This link has the solution but it is