This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncw
Recipients amaury.forgeotdarc, bpb, eric.araujo, fdrake, jackdied, ncw, rhettinger, terry.reedy
Date 2010-09-29.10:32:14
SpamBayes Score 5.892934e-09
Marked as misclassified No
Message-id <1285756336.38.0.567376596131.issue5131@psf.upfronthosting.co.za>
In-reply-to
Content
Raymond Hettinger (rhettinger) wrote:
> Ben, I don't think there is any value is opening more issues like pprint-doesn't-handle-object-x (named tuples, defautdicts, deques, generators, etc).
> 
> As it is currently designed, pprint doesn't offer usable hooks and it is not easy to build-out to handle new object types.  For the most part, users just cast to a list before calling pprint.

I mildly disagree, IMHO pprint should be able to make a decent job of all the built in types otherwise it loses its value as a debugging tool.  It is a suprise when a built in type doesn't pprint properly.

This would surely be an excellent use of the abstract base classes defined in the collections module for pprint to make a best guess as to how to print types it doesn't understand directly?

> ISTM, the RightAnswer(tm) is to overhaul pprint and add hooks for handling new objects.  Ideally, there would be flexible print options and reprlib-like features for limiting output and for marking recursive constructs with "..."

That is a very good idea, but might be unecessary with the ABC idea above
History
Date User Action Args
2010-09-29 10:32:16ncwsetrecipients: + ncw, fdrake, rhettinger, terry.reedy, amaury.forgeotdarc, jackdied, bpb, eric.araujo
2010-09-29 10:32:16ncwsetmessageid: <1285756336.38.0.567376596131.issue5131@psf.upfronthosting.co.za>
2010-09-29 10:32:15ncwlinkissue5131 messages
2010-09-29 10:32:14ncwcreate