[Python-bugs-list] pprint.pprint gives recursive message on my tuple :))

Guido van Rossum guido@CNRI.Reston.VA.US
Thu, 02 Sep 1999 09:31:48 -0400


(You are using the python-bugs-list address wrongly.  This is a
distribution list used by the bug reporting system, see "python bugs
list" on the python homepage.)

There's a bug in your data: if a is the top-level list from your
pickle, t[-40] and t[-26] are the same object.

I would say there's also a bug in pprint, because there is no
recursion.  I'll ask Fred to look into it.

[Fred: the problem is exemplified by this:

>>> import pprint
>>> x = (('enth', '.: '), ((('10', '&'), ('nbsp', ';')), (('Amp', '. ('), ('N2', '), '))))
>>> y = x, x
>>> pprint.pprint(y)
((('enth', '.: '),
  ((('10', '&'), ('nbsp', ';')), (('Amp', '. ('), ('N2', '), ')))),
 <Recursion on tuple with id=1301816>)
>>> 

There is no actual recursion, just a repeated nested tuple.  I don't have
simpler cases that exhibit this behavior.

--Guido van Rossum (home page: http://www.python.org/~guido/)