diff options
author | Guido van Rossum <guido@python.org> | 2007-10-16 18:12:55 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-10-16 18:12:55 (GMT) |
commit | 3172c5d263eeffff1e89d03d79be3ccc1d60fbde (patch) | |
tree | a35e103b36b684c4682ded57236199d6a0ecee4b /Lib/io.py | |
parent | 60d241f135f10312f5a638846659d7e471f6cac9 (diff) | |
download | cpython-3172c5d263eeffff1e89d03d79be3ccc1d60fbde.zip cpython-3172c5d263eeffff1e89d03d79be3ccc1d60fbde.tar.gz cpython-3172c5d263eeffff1e89d03d79be3ccc1d60fbde.tar.bz2 |
Patch# 1258 by Christian Heimes: kill basestring.
I like this because it makes the code shorter! :-)
Diffstat (limited to 'Lib/io.py')
-rw-r--r-- | Lib/io.py | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -103,13 +103,13 @@ def open(file, mode="r", buffering=None, encoding=None, newline=None): binary stream, a buffered binary stream, or a buffered text stream, open for reading and/or writing. """ - if not isinstance(file, (basestring, int)): + if not isinstance(file, (str, int)): raise TypeError("invalid file: %r" % file) - if not isinstance(mode, basestring): + if not isinstance(mode, str): raise TypeError("invalid mode: %r" % mode) if buffering is not None and not isinstance(buffering, int): raise TypeError("invalid buffering: %r" % buffering) - if encoding is not None and not isinstance(encoding, basestring): + if encoding is not None and not isinstance(encoding, str): raise TypeError("invalid encoding: %r" % encoding) modes = set(mode) if modes - set("arwb+tU") or len(mode) > len(modes): @@ -1092,7 +1092,7 @@ class TextIOWrapper(TextIOBase): def write(self, s: str): if self.closed: raise ValueError("write to closed file") - if not isinstance(s, basestring): + if not isinstance(s, str): raise TypeError("can't write %s to text stream" % s.__class__.__name__) haslf = "\n" in s @@ -1394,7 +1394,7 @@ class StringIO(TextIOWrapper): encoding=encoding, newline=newline) if initial_value: - if not isinstance(initial_value, basestring): + if not isinstance(initial_value, str): initial_value = str(initial_value) self.write(initial_value) self.seek(0) |