[Python-ideas] truncate sequences in pretty-print ?

Steven Samuel Cole steven.samuel.cole at gmail.com
Sun Sep 18 06:59:14 CEST 2011


i use pprint quite a bit during development to give me quick insight
into what is going on inside my application.
however, when there's any sequences involved, the output becomes less
useful the longer these sequences are - i often find myself scrolling
around (or even searching) in the terminal window, trying to find the
bit of output i am interested in.

imo, it would be great if pprint had a parameter 'max_len' or so that
reduces output of every sequence to a maximum and inserts something
like '...' to indicate truncation, e.g.
{'my key': ['my list item 01',
            'my list item 02',
            'my list item 03',
            'my list item 04',
            'my list item 05',
            'my list item 06',
            'my list item 07',
            'my list item 08',
            'my list item 10',]}

somewhat comparable to the '...' already printed when a structure is
more deeply nested than you want to know right now.

what do you think ?



More information about the Python-ideas mailing list