summaryrefslogtreecommitdiff
path: root/Lib/repr.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2006-04-20 16:07:39 +0000
committerGuido van Rossum <guido@python.org>2006-04-20 16:07:39 +0000
commit06f44b47f3f6e64c8aed3a50c1a4f2dd89e61bdf (patch)
treec0c4adc63be1496bef267500cf743392c9e098dd /Lib/repr.py
parenteab53cf81985d2c68fecb138e23271c4273393f8 (diff)
downloadcpython-06f44b47f3f6e64c8aed3a50c1a4f2dd89e61bdf.tar.gz
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.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/Lib/repr.py b/Lib/repr.py
index 53b5207e5f..32544a27c1 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