From: Christopher B. <Chr...@no...> - 2006-10-19 20:59:59
|
Travis Oliphant wrote: > Actually something as simple as > > class InfoArray(N.ndarray): > pass > > will allow you to add attributes to InfoArray. Well, sure, but how the heck do you initialize it? >>> class InfoArray(N.ndarray): ... pass ... >>> InfoArray((1,2,3)) InfoArray([[[ 6.61855173e-306, nan, 4.94708449e+173], [ 3.32457336e-309, 1.08825491e+175, 2.12468326e-314]]]) InfoArray(N.array((1,2,3))) InfoArray([[[ 2.17854722e-305, 1.90979621e-313, 1.90979621e-313], [ 1.90979621e-313, 1.90979621e-313, 1.03977794e-312]]]) I, for one, would like a very easy to subclass version of ndarray, maybe one that had a default constructor like numpy.array(). oh, and: Charles R Harris wrote: > I'd be more inclined to worry about speed. One of the drawbacks of > numarray was the time it took to create arrays. Since I often use many > small arrays, numpy was a big improvement in that area. +1 keep basic arrays simple and lean. Wasn't there one a UserArray class or something? -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |