summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2002-05-10 21:00:35 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2002-05-10 21:00:35 (GMT)
commite037665f999c2ab5637fd9c2f4ac5c24e44e48f0 (patch)
tree77787a85f0d3481d3b1d4b2b0be0415120d17aba /Lib
parentfad2f5931323e9686230fe27d261f2172a361969 (diff)
downloadcpython-e037665f999c2ab5637fd9c2f4ac5c24e44e48f0.zip
cpython-e037665f999c2ab5637fd9c2f4ac5c24e44e48f0.tar.gz
cpython-e037665f999c2ab5637fd9c2f4ac5c24e44e48f0.tar.bz2
Use isinstance() in preference to comparison of type by is.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/StringIO.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/StringIO.py b/Lib/StringIO.py
index cc88e9d..9225c05 100644
--- a/Lib/StringIO.py
+++ b/Lib/StringIO.py
@@ -39,7 +39,7 @@ __all__ = ["StringIO"]
class StringIO:
def __init__(self, buf = ''):
# Force self.buf to be a string or unicode
- if type(buf) is not types.UnicodeType:
+ if not isinstance(buf, types.UnicodeType):
buf = str(buf)
self.buf = buf
self.len = len(buf)
@@ -138,7 +138,7 @@ class StringIO:
raise ValueError, "I/O operation on closed file"
if not s: return
# Force s to be a string or unicode
- if type(s) is not types.UnicodeType:
+ if not isinstance(s, types.UnicodeType):
s = str(s)
if self.pos > self.len:
self.buflist.append('\0'*(self.pos - self.len))