On 2009-01-29 08:20, Aahz wrote: > The reason I'm chiming in is that I would welcome a PEP that created a > __pprint__ method as an alternative to special-casing. I think that it > would be generically useful for user-created objects, plus once you've > added this feature other people can easily do some of the grunt work of > extending this through the Python core. (Actually, unless someone > objects, I don't think a PEP is required, but it would be good for the > usual reasons that PEPs are written, to provide a central place > documenting the addition.) I think it's worth looking at Armin Ronacher's pretty.py for a starting point. http://dev.pocoo.org/hg/sandbox/file/tip/pretty I've been using it as my default displayhook under IPython for a few weeks now. It uses a combination of a function registry and a __pretty__ special method to find the right pretty printer. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4