Mercurial > cpython-lru_cache-weakref
diff Lib/pprint.py @ 29379:347e7b6dfd53 legacy-trunk
Revert 1.25, as overloaded __repr__ is not considered.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Sat, 07 Jun 2003 20:47:37 +0000 |
| parents | 24e74d687980 |
| children | e3025fe70d8b |
line wrap: on
line diff
--- a/Lib/pprint.py Sat Jun 07 20:17:11 2003 +0000 +++ b/Lib/pprint.py Sat Jun 07 20:47:37 2003 +0000 @@ -130,7 +130,7 @@ write = stream.write if sepLines: - if issubclass(typ, dict): + if typ is dict: write('{') if self._indent_per_level > 1: write((self._indent_per_level - 1) * ' ') @@ -157,8 +157,8 @@ write('}') return - if issubclass(typ, list) or issubclass(typ, tuple): - if issubclass(typ, list): + if typ is list or typ is tuple: + if typ is list: write('[') endchar = ']' else: @@ -179,7 +179,7 @@ allowance + 1, context, level) indent = indent - self._indent_per_level del context[objid] - if issubclass(typ, tuple) and length == 1: + if typ is tuple and length == 1: write(',') write(endchar) return @@ -207,7 +207,7 @@ def _safe_repr(object, context, maxlevels, level): typ = _type(object) - if issubclass(typ, basestring): + if typ is str: if 'locale' not in _sys.modules: return `object`, True, False if "'" in object and '"' not in object: @@ -226,7 +226,7 @@ write(qget(char, `char`[1:-1])) return ("%s%s%s" % (closure, sio.getvalue(), closure)), True, False - if issubclass(typ, dict): + if typ is dict: if not object: return "{}", True, False objid = _id(object) @@ -251,8 +251,8 @@ del context[objid] return "{%s}" % _commajoin(components), readable, recursive - if issubclass(typ, list) or issubclass(typ, tuple): - if issubclass(typ, list): + if typ is list or typ is tuple: + if typ is list: if not object: return "[]", True, False format = "[%s]"
