On Tue, Mar 8, 2011 at 07:59, Sam Tygier <sam.tyg...@hep.manchester.ac.uk> wrote: > Hi > > I am having an issue with boolean slicing. it seems to work fine for > reading a value, but I can use it to set a value: > > import numpy > b = numpy.array([[1,2],[3,4],[5,6],[7,8],[9,10]]) > m = numpy.array([0,1,0,0,0], dtype=bool) > print b[m] > print b[m][0,0] > b[m][0,0] = -1 > print b[m][0,0] > > I think the boolean slicing is making a copy instead of a view. is there > a way around this?
bm = b[m] bm[0,0] = -1 b[m] = bm -- 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://mail.scipy.org/mailman/listinfo/numpy-discussion