printing recursive data (was Re: v1.0.2 question)

Marc Wachowitz (
5 May 1994 10:34:41 GMT

Guido van Rossum wrote:
> Beyond that, the routines that print mutable objects like lists and
> dictionaries would have to be fixed to trap recursion somehow. This
> seems like a tedious job (keep a stack of objects already being
> printed) and there's the question, WHAT to print instead of the
> recursive object?

In Common Lisp, there's a notation both for input and output of recursive
data structures (I think you must activate it explicitly for printing). I
don't remember the exact notation for sure, but it's somewhat like

(a #1=(b c #1) e)

where #1= is a label for the following object and #1 references it.

(Of course, "#" wouldn't be reasonable for Python ;-)

* wonder everyday * nothing in particular * all is special *
Marc Wachowitz <>