Sebastian Haase wrote: >Hi, >I suppose the answer is no . >But converting more code to numpy I got this error >AttributeError: 'numpy.flatiter' object has no attribute 'dtype' >(I found that I did not need the .flat in the first place ) >So I was just wondering if (or how much) a flatiter object should behave like >an ndarray ? > > It's a good question. Right now, they act like an array when passed to functions, but don't have the same attributes and/or methods of an ndarray. I've not wanted to add them because I'm not sure how far thinking that a.flat is an actual array will go and so it's probably better not to try and hide the fact that it isn't an array object.
I've slowly added a few things (like comparison operators), but the real-purpose of the object returned from .flat is for indexing using flat indexes into the array. a.flat[10] = 10 a.flat[30] Beyond that you should use .ravel() (only copies when necessary to create a contiguous chunk of data) and .flatten() (copies all the time). -Travis ------------------------------------------------------------------------- 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