What is the reason that pprint is not made the default print?
- It is written in Python. That makes it harder (but not impossible) to make it a builtin.
- Although pprint does go back a long time, to Python 1.5 or older, it is not as old as the builtin print.
- It is heavier-weight than the builtin print. It requires a moderately large class, regexes, and much more to work. Making it the default will slow down Python startup for people who don’t care about pretty-printing, or do their own.
- The output format is different, so changing the default will break doctests that use the original print.
- Changing the builtin print to pprint will break backwards compatibility: the signatures of the two functions are completely different:
print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False) pprint(object, stream=None, indent=1, width=80, depth=None, *, compact=False)
It is easy enough to import pprint. Not everything needs to be a builtin. But if you want to make it even easier, create a PYSTARTUP file and put
from pprint import pprint in it.