pprint module and newer standard types

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paddy

    pprint module and newer standard types

    Hi,
    When I try and use pprint on standard types I get varying 'quality of
    output'.

    Lists will wrap nicely to multiple lines as will dicts, but sets and
    defaultdicts give one long unreadable line.
    Is their a chance to get this changed so that more built-in types look
    pretty when printed with pprint?

    I just did a small trial on an early version of Python 3 and sets
    don't seem to obey pprint.pprints width argument, the same way that
    lists do:

    Python 3.0a1 (py3k:57844, Aug 31 2007, 16:54:27) [MSC v.1310 32 bit
    (Intel)] on win32
    >>from pprint import pprint as pp
    >>pp(list(range (3)), width=4)
    [0,
    1,
    2]
    >>pp(set(range( 3)), width=4)
    {0, 1, 2}
    >>>

    - Paddy.
Working...