473,395 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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.
Apr 9 '08 #1
0 1177

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

38
by: Anthony Baxter | last post by:
On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.3.1 (final). Python 2.3.1 is a pure bug fix release of Python 2.3, released in...
0
by: Josiah Carlson | last post by:
Good day everyone, I have produced a patch against the latest CVS to add support for two new formatting characters in the struct module. It is currently an RFE, which I include a link to at the...
1
by: Kenneth McDonald | last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate feedback, suggestions, and criticism as I work towards finalizing the API and feature sets. rex is a module intended to make...
18
by: Steven Bethard | last post by:
In the "empty classes as c structs?" thread, we've been talking in some detail about my proposed "generic objects" PEP. Based on a number of suggestions, I'm thinking more and more that instead of...
3
by: Zachary Pincus | last post by:
Hi folks, I'm sure this has come up before, but the search terms I've been using are so non-specific that I can't get any traction on Google. Here's my question: I have written a subclass of...
9
by: John Salerno | last post by:
Just wondering if this will ever happen, maybe in 3.0 when print becomes a function too? It would be a nice option to have it available without importing it every time, but maybe making it a...
6
by: Brian L. Troutwine | last post by:
The heading comment to pprint reads: # This is a simple little module I wrote to make life easier. I didn't # see anything quite like it in the library, though I may have overlooked # ...
0
by: Donald 'Paddy' McCarthy | last post by:
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...
1
by: rh0dium | last post by:
Hi all, Perhaps it's not supposed to work like this but I thought if you supplied a width to pprint it would nicely format a list to the width. KEYS = pp = pprint.PrettyPrinter(indent=2)...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.