[Python-bugs-list] [ python-Bugs-423781 ] pprint.isrecursive() broken

noreply@sourceforge.net noreply@sourceforge.net
Sun, 13 May 2001 23:44:11 -0700


Bugs item #423781, was updated on 2001-05-13 13:30
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=423781&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Tim Peters (tim_one)
>Assigned to: Tim Peters (tim_one)
Summary: pprint.isrecursive() broken

Initial Comment:
Assigned to Moshe because mathematicians love 
recursion <wink>.  The code is clearly broken, but 
it's not immediately clear how to fix it.

>From c.l.py:


-----Original Message-----
From: python-list-admin@python.org
    On Behalf Of Roman Suzi
Sent: Sunday, May 13, 2001 3:36 PM
To: python-list@python.org
Subject: pprint.isrecursive: is it ever recursive? (a 
bug?)


Hello!

I was looking at pprint code and out of curiosity tried
to repr self-referencing list:

>>> import pprint
>>> l=[1,2]
>>> l[0]=l
>>> pprint.isreadable(l)
0
>>> pprint.isrecursive(l)
0
>>> l
[[...], 2]
>>> pprint.saferepr(l)
'[<Recursion on list with id=135078960>, 2]'
>>>


However, it seems to me that isrecursive(l) must be 1, 
not 0.  Or do I misunderstand it's meaning?


----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-05-13 23:44

Message:
Logged In: YES 
user_id=31435

Assigned to me -- the pprint code isn't even close to 
working correctly.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=423781&group_id=5470