diff options
author | Tim Peters <tim.peters@gmail.com> | 2003-02-05 18:29:34 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2003-02-05 18:29:34 (GMT) |
commit | 6ee0480521901d3e84769d1590603f89efd456a4 (patch) | |
tree | 9ecc2d6febd0422f8ea6018c7625a02c7b636f60 /Lib/repr.py | |
parent | 5c4ded2c3b59aa134b82ab17cdfe7ab633194ca6 (diff) | |
download | cpython-6ee0480521901d3e84769d1590603f89efd456a4.zip cpython-6ee0480521901d3e84769d1590603f89efd456a4.tar.gz cpython-6ee0480521901d3e84769d1590603f89efd456a4.tar.bz2 |
[680789] Debug with long array takes forever
Added array.array to the types repr.py knows about, after a suggestion
from Jurjen N.E. Bos.
Diffstat (limited to 'Lib/repr.py')
-rw-r--r-- | Lib/repr.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/repr.py b/Lib/repr.py index c69ce28..0431857 100644 --- a/Lib/repr.py +++ b/Lib/repr.py @@ -7,6 +7,7 @@ class Repr: self.maxlevel = 6 self.maxtuple = 6 self.maxlist = 6 + self.maxarray = 5 self.maxdict = 4 self.maxstring = 30 self.maxlong = 40 @@ -48,6 +49,23 @@ class Repr: s = s + self.repr1(x[i], level-1) if n > self.maxlist: s = s + ', ...' return '[' + s + ']' + + def repr_array(self, x, level): + n = len(x) + header = "array('%s', [" % x.typecode + if n == 0: + return header + "])" + if level <= 0: + return header + "...])" + s = '' + for i in range(min(n, self.maxarray)): + if s: + s += ', ' + s += self.repr1(x[i], level-1) + if n > self.maxarray: + s += ', ...' + return header + s + "])" + def repr_dict(self, x, level): n = len(x) if n == 0: return '{}' |