[Numpy-discussion] does an ndarray have a "hook" for a dictionary attribute ?

Pierre GM pgmdevlist@gmail....
Thu Nov 12 06:45:34 CST 2009


On Nov 12, 2009, at 4:47 AM, Sebastian Haase wrote:

> On Thu, Nov 12, 2009 at 10:38 AM, Sebastian Haase <seb.haase@gmail.com> wrote:
>> Hi,
>> 
>> I hope my subject line is not entirely incomprehensible:
>> I remember there was a discussion (some time ago) that every ndarray
>> instance should get an extra dictionary (or just a "hook" for it, to
>> minimize the memory foot print) for "application specific" /
>> "auxiliary" data.
>> What is the current state on this ?

Nothing so far, I think... 

>> do I need to subclass ndarray to make such a ndarray_with_dict

Why go for a full dictionary ?
But anyway, yes, subclassing might be the fastest solution for you


>> 
>> (For the latter it would be very helpful to get a hint on how to make
>> such a "minimal" ndarray-subclass . I remember some issues involving
>> some special __new__ methods, that I don't entirely remember by
>> heard..)

What kind of issues ?
Anyhow, by now I'm sure you already googled "numpy subclassing" and checked the first two entries (one in the documentation, one on the cookbook). The examples given should be clear enough , but let me know if you have any problem.
Cheers
P.




More information about the NumPy-Discussion mailing list