
Aug. 11, 2007
12:14 a.m.
Perhaps `repr` instead could grow a `pretty` parameter, default False; if true, it could also take the `depth`, `indent`, and `width` parameters that `pformat` now takes. It would act basically like `pformat` in that case. Normally it would do its best to pretty-format known data types, using __repr__ otherwise, but perhaps objects could also override a __prettyrepr__ method, always taking (object, indent, width, depth), and returning a pretty-formated string. This function could pass those parameters along recursively to repr(x, pretty=True, ...) again if it has child objects it needs to represent.