buffer_info() for arrays but not structs?

Gene Chiaramonte gchiaramonte at ibl.bm
Tue Feb 29 20:49:47 CET 2000


Good point. duh :-(

I have been using windll from Sam Rushing to get a pointer to a variable.

var1 = windll.membuf(struct.pack('f', 0.0))
var1 = struct.unpack('f', var1.mb.read())

With the array module you can do this:

temp_array = array.array('h', [1, 2, 3])
temp_array_ptr = order_array.buffer_info()[0]

Is there a way to get the address of a variable or struct using the standard
python libraries? I'm wondering if there is a python function to do this
that I have not found.

Gene

> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of Thomas Heller
> Sent: Tuesday, February 29, 2000 2:51 PM
> To: gchiaramonte at ibl.bm; python-list at python.org
> Subject: Re: buffer_info() for arrays but not structs?
>
>
> > Is there a reason an array has a buffer_info() method but a
> struct doesn't?
> > This would be a nice addition to the struct object. Does anyone know if
> > there are plans to add this?
>
> Probably because a struct is not an object. At least in 1.5.
>
> Thomas Heller
>
>
> --
> http://www.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list