On Mon, Mar 2, 2009 at 19:20, Brian Gerke <bge...@slac.stanford.edu> wrote: > > Many thanks for your willingness to help out with this. Not to > belabor the point, but I notice that the rules you lay out below don't > quite explain why the following syntax works as I originally expected: > > r[0].field1 = 1 > > I'm guessing this is because r[0].field1 is already an existing scalar > object, with an address in memory, so it can be changed in place, > whereas this syntax would need to create an entirely new array object > (not even a copy, exactly): > > r[where(r.field1 == 0)].field1 > > No need to respond if this understanding is correct. I just wanted to > write it down in case someone else is searching the archive with this > question in the future.
Close. It's not "already existing", but a record scalar that gets created by a[0] is a view onto the corresponding element in the original array and is mutable. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion