Michael McNeil Forbes wrote: > Is the following the desired behaviour for setting recarray attributes? > This seems to clash with the semantics for arrays. > > >>> from numpy import * > >>> a = array([1,2,3]) > >>> b = a.view([('x',int),('y',int),('z',int)]) > >>> r = b.view(recarray) > >>> b['x'] = 0 > >>> r.y = 0 > >>> a > array([0, 2, 3]) > >>> r.x > array([0]) > >>> r.y > 0 > > Setting r.y creates a local variable in r.__dict__ which is then > accessed rather than the array element referred to by fielddict. >
Hmm.... I know that the code was changed at some point a few months ago specifically to this behavior because of some concerns Perry, Chris (people at STScI) had. Originally, field names came first, but we changed it so they could set known attributes of a record array even if they were also field names. This may be an unintentional side-effect. So, let's not just change things again and create problems for them. -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