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

numpy-svn@scip... numpy-svn@scip...
Wed Jul 30 16:13:05 CDT 2008


Author: stefan
Date: 2008-07-30 16:12:48 -0500 (Wed, 30 Jul 2008)
New Revision: 5576

Modified:
   trunk/numpy/lib/io.py
Log:
Fix string type comparisons.


Modified: trunk/numpy/lib/io.py
===================================================================
--- trunk/numpy/lib/io.py	2008-07-30 20:50:20 UTC (rev 5575)
+++ trunk/numpy/lib/io.py	2008-07-30 21:12:48 UTC (rev 5576)
@@ -8,7 +8,6 @@
 import numpy as np
 import format
 import cStringIO
-import tempfile
 import os
 import itertools
 
@@ -109,7 +108,7 @@
     ------
     IOError
     """
-    if isinstance(file, type("")):
+    if isinstance(file, basestring):
         fid = _file(file,"rb")
     else:
         fid = file
@@ -148,7 +147,7 @@
     np.save('myfile', a)
     a = np.load('myfile.npy')
     """
-    if isinstance(file, str):
+    if isinstance(file, basestring):
         if not file.endswith('.npy'):
             file = file + '.npy'
         fid = open(file, "wb")
@@ -171,7 +170,7 @@
     # component of the so-called standard library.
     import zipfile
 
-    if isinstance(file, str):
+    if isinstance(file, basestring):
         if not file.endswith('.npz'):
             file = file + '.npz'
 
@@ -186,6 +185,7 @@
 
     # Place to write temporary .npy files
     #  before storing them in the zip
+    import tempfile
     direc = tempfile.gettempdir()
     todel = []
 



More information about the Numpy-svn mailing list