Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Improve documentation for pprint module #115986

Copy link
Copy link
Closed
@AlexWaygood

Description

@AlexWaygood
Issue body actions

Documentation

The documentation for the pprint module could be improved in many respects:

  • Most users will probably only ever need to use pprint.pp() or pprint.pprint(), but these are buried halfway down the module. It would be nice if these were the first things on the page.
  • All examples in the documentation use pprint.pprint(), which has some unexpected behaviour. For example, it sorts dictionaries by default, which is somewhat unintuitive now that dictionaries maintain insertion order. I suggest we change the examples to use pprint.pp() instead, which has the more intuitive default of sort_dicts=False.
  • Similarly, the docs for pprint.pprint() could explicitly call out that it has unintuitive defaults for things such as sort_dicts and link to pprint.pp()
  • Some links in the module's documentation incorrectly point to the module itself (pprint) instead of the function pprint.pprint().

These don't all necessarily need to be tackled in the same PR

Linked PRs

Metadata

Metadata

Assignees

Labels

docsDocumentation in the Doc dirDocumentation in the Doc dir

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.