[issue13004] pprint: add option to truncate sequences

Steven Samuel Cole report at bugs.python.org
Wed Sep 21 05:49:56 CEST 2011


Steven Samuel Cole <steven.samuel.cole at gmail.com> added the comment:

@anand: as the names say, the depth parameter limits the depth of display while the length parameter limits the length.

for example, with a data structure of a list of lists of lists and a depth of 2, only the first two levels would be shown, the third list at the 'bottom' would be replaced by '...'

on the other hand, in a list with 10 entries and a length parameter of 5, only 5 list entries would be displayed.

@Raymond: agreed. i have squeezed max_len into the existing code and ported that back to 2.6 for my current project; while it works, it is a bad hack. i would much more prefer bundling efforts into an extensible pprint rewrite.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13004>
_______________________________________


More information about the Python-bugs-list mailing list