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)
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))