Python 3.x: alternative pprint implementation -


standard pprint module nice when deals lists, dicts , on. unusable custom classes:

  • the way make print usable information object of class override __repr__, if class have nice, eval()'able __repr__ not showing information want see in pprint ouput?

  • ok, write print-oriented __repr__, in case impossible pretty-print inside class:

.

class data:     def __init__(self):         self.d = {...} 

i can't pretty-print self.d contents, can return one-line representation only(at least without playing stacktraces, etc). - overriding prettyprinter not option, dont want every time want pretty-print same class.

so... there alternatives pprint allows make custom class pretty-printable?

there improved , maintained python 2.x/3.x port of "pretty" library in ipython: http://ipython.org/ipython-doc/stable/api/generated/ipython.lib.pretty.html


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -