[Python-ideas] reprs of recursive datastructures.

Terry Reedy tjreedy at udel.edu
Sat Sep 8 09:23:14 CEST 2012

On 9/8/2012 2:27 AM, Guido van Rossum wrote:
> Can someone explain what problem we are trying to solve? I fail to
> uderstand what's wrong with the current behavior...

Pairs of different things have the same representation, making the 
representation ambiguous to both people and the interpreter. Moreover, 
the interpreter's guess is usually wrong.

In particular, the representations of recursive lists use what is now 
the Ellipsis literal '...', so they are also valid list displays for a 
non-recursive nested list containing Ellipsis. The interpreter always 
reads ... as the Ellipsis literal, which it nearly always is not what is 

It would be trivial to tweak the representations of recursive lists so 
they are not valid list displays.

Terry Jan Reedy

Terry Jan Reedy

More information about the Python-ideas mailing list