title: python3: pretty-print alternatives to "pprint.pformat" and "json.dumps"
body: <p>I want to pretty-print python objects in a way that differs somewhat from how <code>json.dumps</code> and <code>pprint.pformat</code> do the formatting. I'm wondering if anyone knows any existing modules that I can use to pretty-print my code as follows:</p>
  
  <p>Suppose I have the following python dictionary:</p>
  
  <pre><code>mydict = { 'a': 'letter a',
             'b': [ 'b', 'b', 'b', 'b' ],
             'c': [ 'c' ],
             'd': [ 'dddd', 'dddd', 'dddd', 'dddd', 'dddd',
                    'dddd', 'dddd', 'dddd', 'dddd', 'dddd',
                    'dddd' ]
           }
  </code></pre>
  
  <p>I would like <code>mydict</code> pretty-printed in much the same way as I wrote it above, <em>i.e.</em> ...</p>
  
  <pre><code>{ 'a': 'letter a',
    'b': [ 'b', 'b', 'b', 'b' ],
    'c': [ 'c' ],
    'd': [ 'dddd', 'dddd', 'dddd', 'dddd', 'dddd',
           'dddd', 'dddd', 'dddd', 'dddd', 'dddd',
           'dddd' ]
  }
  </code></pre>
  
  <p>In other words, for lists and other similar items, I'd like each item to be listed across the page until it reaches some maximum specified width, and then for it to wrap onto a new line that is left-aligned with the data in the line above.</p>
  
  <p>I have been trying different combinations of parameters for <code>json.dumps</code> and <code>pprint.pformat</code>, but I haven't figured out how to obtain this long-line behavior.</p>
  
  <p>I'm sure I could write something like this myself, but instead, I'm hoping that there are one or more existing modules that I can use in order to pretty-print in this way.</p>
  
  <p>Does anyone know of something out there in the wild which already is able to pretty-print in this manner?</p>
  
  <p>Thank you very much.</p>