[Python-ideas] reprs of recursive datastructures.
Nick Coghlan
ncoghlan at gmail.com
Sat Sep 8 12:02:04 CEST 2012
On Sat, Sep 8, 2012 at 7:49 PM, Guido van Rossum <guido at python.org> wrote:
> To what purpose? I still don't understand what the actual use case is
> where you think that will produce a better experience for the user.
The thing I don't like is that the current display flat out lies about
the sequence contents - it displays a terminal constant ("..."),
rather than a clear marker that a recursive loop was detected.
The case of multiple references to a different list is not the same,
as then the repr() at least still accurately reflects what you would
get when iterating over the data structure.
So, my perspective is if attempting to naively flatten the list would
create an infinite loop, then I want evaluating the representation to
throw a syntax error the way it did in Python 2.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list