Travis Oliphant wrote: > Tom Denniston wrote: > >> The following works on a float array but not an object array. It >> gives a very strange error message. >> >> (Pdb) numpy.log(numpy.array([19155613843.7], dtype=object)) >> *** AttributeError: 'float' object has no attribute 'log' >> >> > This is expected behavior. For object arrays the ufuncs look to the > objects themselves for implementation. In this case. The ufunc tries > to call the log method of each entry in the array. The first entry is a > float (which as the error shows) does not have a log attribute and so > you get a failure. > It seems like we could do better than this. Couldn't the ufunc call *itself* on on objects in an object array? That is, ufunc(object_array) would be more or less equivalent to map(ufunc, object_array) [mostly less, but hopefully you get the idea]. I haven't looked into the gory details, and I'm not likely to soon since I'm tied up with other stuff, but I figured I'd toss the idea into the ring.
-tim ------------------------------------------------------------------------- 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 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion