Title: Add colour to `pprint` output · Issue #145217 · python/cpython · GitHub
Open Graph Title: Add colour to `pprint` output · Issue #145217 · python/cpython
X Title: Add colour to `pprint` output · Issue #145217 · python/cpython
Description: Feature or enhancement Proposal: We can use the existing syntax theme to add colour to the output of: pprint.pp(data) pprint.pprint(data) pprint.PrettyPrinter().pprint(data) cpython/Lib/_colorize.py Lines 312 to 323 in 9b22261 class Synt...
Open Graph Description: Feature or enhancement Proposal: We can use the existing syntax theme to add colour to the output of: pprint.pp(data) pprint.pprint(data) pprint.PrettyPrinter().pprint(data) cpython/Lib/_colorize.p...
X Description: Feature or enhancement Proposal: We can use the existing syntax theme to add colour to the output of: pprint.pp(data) pprint.pprint(data) pprint.PrettyPrinter().pprint(data) cpython/Lib/_colorize.p...
Opengraph URL: https://github.com/python/cpython/issues/145217
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add colour to `pprint` output","articleBody":"# Feature or enhancement\n\n### Proposal:\n\nWe can use the existing `syntax` theme to add colour to the output of:\n\n* `pprint.pp(data)`\n* `pprint.pprint(data)`\n* `pprint.PrettyPrinter().pprint(data)`\n\nhttps://github.com/python/cpython/blob/9b22261a86b54f198225426e86390ef8dd85e091/Lib/_colorize.py#L312-L323\n\nAs usual, this will respect the environment variables to control colour and the output stream's capabilities.\n\n### Has this already been discussed elsewhere?\n\nThis is a minor feature, which does not need previous discussion elsewhere\n\n### Links to previous discussion of this feature:\n\n_No response_\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-145218\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/hugovk","@type":"Person","name":"hugovk"},"datePublished":"2026-02-25T14:19:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/145217/cpython/issues/145217"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4f90ead2-8d0b-3308-3b4e-3cb942cd016c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DD34:2FBA0B:1E548E:2844C9:6A53FE6F |
| html-safe-nonce | a4c9bbffc9a6650e8e8a732710534a18b54d49563af279834ce44fc210b4dd8a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERDM0OjJGQkEwQjoxRTU0OEU6Mjg0NEM5OjZBNTNGRTZGIiwidmlzaXRvcl9pZCI6Ijc3MjIzNTEyMDQyODY4NTY4MTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c0ed2cc03276603a2541fb7d65a0305552fd67242e49724e26d4c2d75d86af23 |
| hovercard-subject-tag | issue:3989758602 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/145217/issue_layout |
| twitter:image | https://opengraph.githubassets.com/18a534e6a3af8c85144afa183bc6b9d7f855a6c30d59d7e8f8332dc0fd50d2f4/python/cpython/issues/145217 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/18a534e6a3af8c85144afa183bc6b9d7f855a6c30d59d7e8f8332dc0fd50d2f4/python/cpython/issues/145217 |
| og:image:alt | Feature or enhancement Proposal: We can use the existing syntax theme to add colour to the output of: pprint.pp(data) pprint.pprint(data) pprint.PrettyPrinter().pprint(data) cpython/Lib/_colorize.p... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hugovk |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width