[Numpy-discussion] problem with assigning to recarrays
Mon Mar 2 19:35:45 CST 2009
On Mon, Mar 2, 2009 at 19:20, Brian Gerke <email@example.com> 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.field1 = 1
> I'm guessing this is because r.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 is a view onto the corresponding element in the
original array and is mutable.
"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
More information about the Numpy-discussion