diff options
author | Guido van Rossum <guido@python.org> | 2006-04-20 16:07:39 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-04-20 16:07:39 (GMT) |
commit | a48a3b42dd78c0201010ed737fdc45244a526648 (patch) | |
tree | d8c38fb35040a77102f969e15a157d5aa315ec6f /Lib/repr.py | |
parent | 08a1a9fac7d754207ac339e1828a789d0462dfd4 (diff) | |
download | cpython-a48a3b42dd78c0201010ed737fdc45244a526648.zip cpython-a48a3b42dd78c0201010ed737fdc45244a526648.tar.gz cpython-a48a3b42dd78c0201010ed737fdc45244a526648.tar.bz2 |
Fix test failures for repr.py.
But shouldn't we kill this module? How many pprint clones do we need?
Diffstat (limited to 'Lib/repr.py')
-rw-r--r-- | Lib/repr.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/Lib/repr.py b/Lib/repr.py index 53b5207..32544a2 100644 --- a/Lib/repr.py +++ b/Lib/repr.py @@ -18,7 +18,7 @@ class Repr: self.maxdeque = 6 self.maxstring = 30 self.maxlong = 40 - self.maxother = 20 + self.maxother = 30 def repr(self, x): return self.repr1(x, self.maxlevel) @@ -31,12 +31,7 @@ class Repr: if hasattr(self, 'repr_' + typename): return getattr(self, 'repr_' + typename)(x, level) else: - s = __builtin__.repr(x) - if len(s) > self.maxother: - i = max(0, (self.maxother-3)//2) - j = max(0, self.maxother-3-i) - s = s[:i] + '...' + s[len(s)-j:] - return s + return self.repr_instance(x, level) def _repr_iterable(self, x, level, left, right, maxiter, trail=''): n = len(x) @@ -112,9 +107,9 @@ class Repr: # exceptions -- then make up something except: return '<%s instance at %x>' % (x.__class__.__name__, id(x)) - if len(s) > self.maxstring: - i = max(0, (self.maxstring-3)//2) - j = max(0, self.maxstring-3-i) + if len(s) > self.maxother: + i = max(0, (self.maxother-3)//2) + j = max(0, self.maxother-3-i) s = s[:i] + '...' + s[len(s)-j:] return s |