From 56365d04c3561ee7d9b9aa21b2d0ba34dd89d7f0 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Wed, 26 Feb 2014 01:38:02 +0200 Subject: [PATCH] BUG: sparse/lil: fix object array assignment issue in Numpy 1.6 --- scipy/sparse/lil.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scipy/sparse/lil.py b/scipy/sparse/lil.py index 4b4a801b8449..103f116e2c8f 100644 --- a/scipy/sparse/lil.py +++ b/scipy/sparse/lil.py @@ -326,16 +326,16 @@ def _mul_scalar(self, other): new = self.copy() new = new.astype(res_dtype) # Multiply this scalar by every element. - new.data[:] = [[val*other for val in rowvals] for - rowvals in new.data] + for j, rowvals in enumerate(new.data): + new.data[j] = [val*other for val in rowvals] return new def __truediv__(self, other): # self / other if isscalarlike(other): new = self.copy() # Divide every element by this scalar - new.data[:] = [[val/other for val in rowvals] for - rowvals in new.data] + for j, rowvals in enumerate(new.data): + new.data[j] = [val/other for val in rowvals] return new else: return self.tocsr() / other