recarray.__setattr__ bug?

Pierre GM pgmdevlist at
Sun Oct 29 00:09:27 CDT 2006

On Saturday 28 October 2006 22:45, Michael McNeil Forbes wrote:
> Since the field names can be used with regular arrays without any
> consequences, I think it would be bad to raise an exception with
> recarrays where there was no problem with regular arrays, and regular
> arrays should allow field names such as 'shape'.

I agree to a certain extent: as switching from regular arrays to recarrays is 
straightforward, any field can potentially can be accessed as an attribute 
and this can brings some serious surprises.
If an exception is too restrictive, a warning should at least be raised (just 
as the new warnings about dividing by zeros) when an array is created with 
field names in a exclude list. As a starter, the exclude list could be most 
(all ?) of the basic attributes/methods of a regular ndarray, along with 
'fields', 'mask'...

> Another concern that I found with the recarray interface is that the
> current implementation exhibits quite poor performance, but I am not
> sure how to fix this yet.

Well, there's a lot of __getattribute__ access: that tends to slow things 
But wouldn't checking whether the fields  are in the 'exclude' list degrade 
the performance even more ?

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo

More information about the Numpy-discussion mailing list