PEP 813: The Pretty Print Protocol

This PEP describes the “pretty print protocol”, a collection of changes proposed to make pretty printing more customizable and convenient.

#python

PEP 813 – The Pretty Print Protocol | peps.python.org

This PEP describes the “pretty print protocol”, a collection of changes proposed to make pretty printing more customizable and convenient.

Python Enhancement Proposals (PEPs)
@peps Here's the PEP I mentioned a few months ago, @treyhunner, although it's changed a bit since then.

@hugovk @peps interesting PEP! Very cool that this would just be a keyword argument to print.

This part is unfortunate (I really don't like the output format pprint uses for the built-in types):

> This also means that there’s no way to control the pretty printed format of built-in types like strings, dicts, lists, etc.

PEP 813 - The Pretty Print Protocol

A couple of the elder statesmen are happy to announce PEP 813, a proposal to build-in optional pretty printing for print(), str.format(), and f-strings, and to define a protocol classes can implement to participate in and customize how their instances are pretty printed. Enjoy, and let the games begin!

Discussions on Python.org