From: Pierre GM <pgm...@gm...> - 2006-10-29 05:09:36
|
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 down. But wouldn't checking whether the fields are in the 'exclude' list degrade the performance even more ? |