[Python-checkins] python/dist/src/Lib repr.py,1.14,1.15
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
Wed, 05 Feb 2003 10:29:35 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv15673/Lib
Modified Files:
repr.py
Log Message:
[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.
Index: repr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/repr.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** repr.py 29 Oct 2001 22:25:44 -0000 1.14
--- repr.py 5 Feb 2003 18:29:33 -0000 1.15
***************
*** 8,11 ****
--- 8,12 ----
self.maxtuple = 6
self.maxlist = 6
+ self.maxarray = 5
self.maxdict = 4
self.maxstring = 30
***************
*** 49,52 ****
--- 50,70 ----
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)