[Numpy-discussion] Setting numpy record array elements

Stefan van der Walt stefan at sun.ac.za
Tue Aug 21 02:40:16 EDT 2007

Hi Sameer

On Mon, Aug 20, 2007 at 06:26:30PM -0500, Sameer DCosta wrote:
> On 8/20/07, Stefan van der Walt <stefan at sun.ac.za> wrote:
> Thanks Stefan for offering to take a closer look. I have attached a
> patch against the latest svn which fixes this problem.

Yup, right on the money.  The __setattr__ call sets the value of
a[0].col1, but a[0].col1 is in fact a pointer to a[0][0].  It is
therefore necessary to use the setfields method.

I cannot think of any situation where you would need to call
__setattr__ on another member of "void", so I'm going to apply the
patch unless anyone objects.


More information about the NumPy-Discussion mailing list