adding an attribute to an nd-array
Christopher Barker
Chris.Barker at noaa.gov
Thu Oct 19 16:59:49 EDT 2006
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
Chris.Barker at noaa.gov
-------------------------------------------------------------------------
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
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
More information about the NumPy-Discussion
mailing list