[Scipy-svn] r3439 - trunk/scipy/sparse
scipy-svn at scipy.org
scipy-svn at scipy.org
Mon Oct 15 18:47:00 EDT 2007
Author: nmarais
Date: 2007-10-15 17:46:49 -0500 (Mon, 15 Oct 2007)
New Revision: 3439
Modified:
trunk/scipy/sparse/sparse.py
Log:
Fix sparse.listprint() to avoid repeated string concatenation
Modified: trunk/scipy/sparse/sparse.py
===================================================================
--- trunk/scipy/sparse/sparse.py 2007-10-15 20:43:47 UTC (rev 3438)
+++ trunk/scipy/sparse/sparse.py 2007-10-15 22:46:49 UTC (rev 3439)
@@ -175,10 +175,8 @@
def listprint(self, start, stop):
"""Provides a way to print over a single index.
"""
- val = ''
- for ind in xrange(start, stop):
- val = val + ' %s\t%s\n' % (self.rowcol(ind), self.getdata(ind))
- return val
+ return '\n'.join(' %s\t%s' % (self.rowcol(ind), self.getdata(ind))
+ for ind in xrange(start,stop)) + '\n'
def __repr__(self):
nnz = self.getnnz()
More information about the Scipy-svn
mailing list