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
Post a Comment