[Matrix] Cannot use zip if it not a square matrix \!
authorSimon Chabot <simon.chabot@logilab.fr>
Fri, 19 Oct 2012 11:38:54 +0200
changeset 31 1410ccfe08fd
parent 30 6b2b4a8d5ff7
child 32 47efa28c96a3
[Matrix] Cannot use zip if it not a square matrix \!
matrix.py
--- a/matrix.py	Fri Oct 19 11:21:44 2012 +0200
+++ b/matrix.py	Fri Oct 19 11:38:54 2012 +0200
@@ -65,7 +65,7 @@
 
         #Get those that exactly matched
         size = self._matrix.get_shape()
-        allindexes = (zip(xrange(size[0]), xrange(size[1])))
+        allindexes = ((i, j) for i in xrange(size[0]) for j in xrange(size[1]))
         zeros = [index for index in allindexes if index not in rowcol]
         for (i, j) in zeros:
             match[i].append((j, 0))