Repository navigation
Conversation
Add a reference for the protocol to the pprint docs: Printer and Expand, the description stream vocabulary (the section markers, DELEGATE, Layout, Keyword, Entry, the marker classes and DescriptionType), decompose() and LEAF. Mark PrettyPrinter soft deprecated. Add object.__pprint__() to the data model reference. Describe !p in the f-string and format string docs, and add it to both grammars. Note the generated __pprint__() for dataclasses and named tuples. Add What's New entries for the protocol, the soft deprecation and PyObject_Pretty(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add Library, Core and Builtins, and C API NEWS entries for the pretty print protocol, and reference pythongh-145153 in the What's New entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A first draft of the documentation for PEP 813 (pythongh-145153). Before this, the branch documented
PyObject_Pretty(),Interpolation.printerandconvert(..., printer), but nothing inpprintitself.Doc/library/pprint.rstBassexample, thenPrinterandExpand, the description stream (VALUES,KWARGS,ITEMS,DELEGATE,Layout,Keyword,Entry,BreakableString/BreakableBytes,FormattableNumber,DescriptionType), anddecompose()withLEAF.PrettyPrinteris markedsoft-deprecated, as the PEP now proposes.Elsewhere
Doc/reference/datamodel.rst: a newobject.__pprint__()entry, including the MRO rule.Doc/builtins/stdtypes.rst:!pis in the list of conversions, and its paragraph now covers the printer spec,None, theSyntaxErrorfor other specs and theTypeErrorcases, with an example.Doc/library/string.rstandDoc/reference/lexical_analysis.rst: both grammars now allowp. The format string prose describes!p, and that a spec after it pads the result.Doc/library/dataclasses.rstandDoc/library/collections.rst: the generated__pprint__(), and that a hand-written__repr__()turns it off.Doc/whatsnew/3.16.rst: a PEP 813 section and highlight, the soft deprecation andPyObject_Pretty()under C API.Checks. sphinx-lint is clean, and a full nitpicky HTML build with CPython's pinned requirements shows no warnings in the changed files. Every example's output was checked against the built interpreter. The
!pexamples use:force:, since Pygments doesn't know the conversion.NEWS. Library, Core and Builtins, and C API entries for pythongh-145153, and the What's New entries reference it too.
🤖 Generated with Claude Code