By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,172 Members | 762 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,172 IT Pros & Developers. It's quick & easy.

pprint module and newer standard types

P: n/a
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.
Apr 9 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.