pprint.isrecursive: is it ever recursive? (a bug?)

Tim Peters tim.one at home.com
Sun May 13 16:32:05 EDT 2001


[Roman Suzi]
> 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?

Na, isrecursive() appears to be broken bigtime.  I opened a bug report for
you:

http://sourceforge.net/tracker/index.php?func=detail&aid=423781&
    group_id=5470&atid=105470





More information about the Python-list mailing list