[Numpy-svn] r5324 - trunk/numpy/lib

numpy-svn at scipy.org numpy-svn at scipy.org
Sat Jun 28 23:37:06 EDT 2008


Author: charris
Date: 2008-06-28 22:37:04 -0500 (Sat, 28 Jun 2008)
New Revision: 5324

Modified:
   trunk/numpy/lib/format.py
Log:
Use join instead of += to build string.


Modified: trunk/numpy/lib/format.py
===================================================================
--- trunk/numpy/lib/format.py	2008-06-29 03:26:00 UTC (rev 5323)
+++ trunk/numpy/lib/format.py	2008-06-29 03:37:04 UTC (rev 5324)
@@ -168,11 +168,12 @@
         This has the appropriate entries for writing its string representation
         to the header of the file.
     """
-    header = "{"
+    header = ["{"]
     for key, value in sorted(d.items()):
         # Need to use repr here, since we eval these when reading
-        header += "'%s': %s, " % (key, repr(value))
-    header += "}"
+        header.append("'%s': %s, " % (key, repr(value)))
+    header.append("}")
+    header = "".join(header)
     # Pad the header with spaces and a final newline such that the magic
     # string, the header-length short and the header are aligned on a 16-byte
     # boundary.  Hopefully, some system, possibly memory-mapping, can take




More information about the Numpy-svn mailing list