[Python-Dev] pprint and list/tuple/dict subclasses

Walter Dörwald walter at livinglogic.de
Tue Dec 2 18:03:36 EST 2003


Fred L. Drake, Jr. wrote:

> Walter Dörwald writes:
>  > Is this patch on SF? What's the patch id?
> 
>     http://www.python.org/sf/750542

OK, I've updated the patch.

Two other ideas for pprint:

The arguments for the PrettyPrinter constructor could
be exposed in pprint() and pformat():
"""
import pprint
print.pprint(foo, indent=3, width=40)
"""

The indent argument could be a string, which is used for indenting,
so indent=" " would be the same as indent=1, indent="   " would
be like indent=3, and we could use something like indent="\t"
or even indent="\033[1;30m...\033[0m".

Bye,
    Walter Dörwald





More information about the Python-Dev mailing list