Nick Craig-Wood <n...@craig-wood.com> added the comment:

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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5131>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to