469,282 Members | 1,921 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

pprint module and newer standard types

When I try and use pprint on standard types I get varying 'quality of

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)
>>pp(set(range(3)), width=4)
{0, 1, 2}

- Paddy.
Apr 9 '08 #1
0 1057

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

38 posts views Thread by Anthony Baxter | last post: by
reply views Thread by Josiah Carlson | last post: by
3 posts views Thread by Zachary Pincus | last post: by
9 posts views Thread by John Salerno | last post: by
6 posts views Thread by Brian L. Troutwine | last post: by
reply views Thread by Donald 'Paddy' McCarthy | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.