From: Travis O. <oli...@ie...> - 2006-05-16 04:14:31
|
Simon Burton wrote: > Sometime between 0.9.5 and 0.9.7.2502 the behaviour of nonzero changed: > > >>>> a=numpy.array([1,1,0,1,1]) >>>> a.nonzero() >>>> > array([0, 1, 3, 4]) > > > now it returns a tuple: > > >>>> a=numpy.array((0,1,1,0,0)) >>>> a.nonzero() >>>> > (array([1, 2]),) > > This is rather unpleasant for me. For example, my collegue > uses OSX and finds only numpy 0.9.5 under darwinports. > > Chris Fonnesback releases quite up-to-date binary releases of NumPy and SciPy for Mac OSX. An alternative solution is to use the functional form: nonzero(a) works the same as a.nonzero() did before for backwards compatibility. The behavior of a.nonzero() was changed for compatibility with numarray. -Travis |