[Numpy-discussion] Setter on array

Pierre Haessig pierre.haessig at crans.org
Fri Aug 16 05:24:21 EDT 2013


Hi Hugo,

Le 14/08/2013 15:34, Hugo Gagnon a écrit :
> What is the best way, if any, to "do something" whenever array elements
> are changed in-place?  For example, if I have a = arange(10), then
> setting a[3] = 1 would, say, call a function automatically.
I've never seen such a signal mechanism specifically for an array *element*.

The only thing that comes close in my mind are the "traits" from
Enthought which are somehow more general.
(http://docs.enthought.com/traits/traits_user_manual/intro.html for an
introduction)
And if I remember, there is an Array type of traits. Then you would get
a signal for any change in such an array, not just a specific element...
May this help ?

best,
Pierre



More information about the NumPy-Discussion mailing list