Message117591
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 |
|
Date |
User |
Action |
Args |
2010-09-29 10:32:16 | ncw | set | recipients:
+ ncw, fdrake, rhettinger, terry.reedy, amaury.forgeotdarc, jackdied, bpb, eric.araujo |
2010-09-29 10:32:16 | ncw | set | messageid: <1285756336.38.0.567376596131.issue5131@psf.upfronthosting.co.za> |
2010-09-29 10:32:15 | ncw | link | issue5131 messages |
2010-09-29 10:32:14 | ncw | create | |
|