[SciPy-User] Notification when array is modified

Jonathan Guyer guyer@nist....
Mon Aug 20 08:03:43 CDT 2012

On Aug 20, 2012, at 3:00 AM, John Jumper wrote:

> I am looking for a method so that I can be notified when the contents
> of a numpy array change.
> Is there any interface in numpy so that I could expose A and B
> directly as writeable numpy arrays but be notified when they are
> modified?  Alternatively, if I subclass ndarray, is there some
> exhaustive list of methods that can change the underlying data (I
> would be worried about view objects here)?

Our FiPy Variable class does this in the course of setting up a mechanism for lazy expression evaluation.


There's a lot in there that you don't need, but see _requires(), _markFresh(), and _markStale(), and the value property. 

See also 


There's unfortunately a lot of work to do to make it all act like an ndarray without subclassing (which was impossible when we originally wrote this and discouraged later. I don't know what the current thinking is on ndarray subclassing).

More information about the SciPy-User mailing list