René's URL Explorer Experiment


Title: gh-90117: handle dict and mapping views in pprint by devdanzin · Pull Request #30135 · python/cpython · GitHub

Open Graph Title: gh-90117: handle dict and mapping views in pprint by devdanzin · Pull Request #30135 · python/cpython

X Title: gh-90117: handle dict and mapping views in pprint by devdanzin · Pull Request #30135 · python/cpython

Description: This PR adds two methods to PrettyPrinter: one to handle dict_keys and dict_values (sorted with _safe_key), another to handle dict_items (sorted using _safe_tuple). Design and implementation open for discussion, thanks in advance. https://bugs.python.org/issue45959 Issue: gh-90117

Open Graph Description: This PR adds two methods to PrettyPrinter: one to handle dict_keys and dict_values (sorted with _safe_key), another to handle dict_items (sorted using _safe_tuple). Design and implementation open...

X Description: This PR adds two methods to PrettyPrinter: one to handle dict_keys and dict_values (sorted with _safe_key), another to handle dict_items (sorted using _safe_tuple). Design and implementation open...

Opengraph URL: https://github.com/python/cpython/pull/30135

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:f48b8b1e-8ca1-5e7a-d07c-a182eca34ca8
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE4C2:2A0045:335EE9B:440A009:6B0039F5
html-safe-nonced7fac96a1b5c4df35854e6df021872ba4d6e7d7163ef5305ccdd0486c9470416
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNEMyOjJBMDA0NTozMzVFRTlCOjQ0MEEwMDk6NkIwMDM5RjUiLCJ2aXNpdG9yX2lkIjoiNTI2NTA1MTM3MDMwMTQzODQ1MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac5a442a26fe1f925e42e61dc6e5cefa3d697d545b405371c7def59a2121d99b65
hovercard-subject-tagpull_request:804265429
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/30135/files
twitter:imagehttps://avatars.githubusercontent.com/u/74280297?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/74280297?s=400&v=4
og:image:altThis PR adds two methods to PrettyPrinter: one to handle dict_keys and dict_values (sorted with _safe_key), another to handle dict_items (sorted using _safe_tuple). Design and implementation open...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasef3f3a43ca095cdea3abbb394112e971f9fdb94fa
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/30135/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F30135%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F30135%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/30135/files
Reloadhttps://github.com/python/cpython/pull/30135/files
Reloadhttps://github.com/python/cpython/pull/30135/files
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
gpsheadhttps://github.com/gpshead
python:mainhttps://github.com/python/cpython/tree/main
devdanzin:pprint_dict_viewhttps://github.com/devdanzin/cpython/tree/pprint_dict_view
Conversation 35 https://github.com/python/cpython/pull/30135
Commits 45 https://github.com/python/cpython/pull/30135/commits
Checks 0 https://github.com/python/cpython/pull/30135/checks
Files changed https://github.com/python/cpython/pull/30135/files
Please reload this pagehttps://github.com/python/cpython/pull/30135/files
gh-90117: handle dict and mapping views in pprint https://github.com/python/cpython/pull/30135/files#top
Show all changes 45 commits https://github.com/python/cpython/pull/30135/files
f7835ca Teach pprint about dict views with PrettyPrinter._pprint_dict_view an… devdanzin Dec 16, 2021 https://github.com/python/cpython/pull/30135/commits/f7835caceaebfa97c88bb5d4b58b11370c005b60
1eda2d5 Merge branch 'main' of https://github.com/python/cpython into pprint_… devdanzin Dec 17, 2021 https://github.com/python/cpython/pull/30135/commits/1eda2d5a56c44bafc956a16749641b21b18a4f1f
9500a74 Use _private names for _dict_*_view attributes of PrettyPrinter. devdanzin Dec 17, 2021 https://github.com/python/cpython/pull/30135/commits/9500a7491d46905491a9b856d8b85258f7d99731
653cdea Use explicit 'items' keyword when calling _pprint_dict_view from _ppr… devdanzin Dec 18, 2021 https://github.com/python/cpython/pull/30135/commits/653cdea1231ff5f9894c4bd18592c45e138d5947
884f224 📜🤖 Added by blurb_it. blurb-it[bot] Dec 18, 2021 https://github.com/python/cpython/pull/30135/commits/884f224b5475a791cfbf349c2ebfb99a77cf25bc
48be1e9 Properly indent code. devdanzin Jan 19, 2022 https://github.com/python/cpython/pull/30135/commits/48be1e9408f23dfd1f5cfc4eaf8d78d9583b39a1
9745491 WIP: Improve tests and make short views sortable. devdanzin Jan 19, 2022 https://github.com/python/cpython/pull/30135/commits/974549119a2901caa0c45e8a9c625321e6a14478
7edb29d fix typo merwok Apr 24, 2022 https://github.com/python/cpython/pull/30135/commits/7edb29d3ee161a662585ac8b1353f6612d0cb6cf
7d2fa0f Merge branch 'main' into pprint_dict_view merwok Apr 24, 2022 https://github.com/python/cpython/pull/30135/commits/7d2fa0f5152b5776994bc81ac9dbbd64f73cfe05
32773ce Merge branch 'main' into pprint_dict_view arhadthedev Mar 4, 2023 https://github.com/python/cpython/pull/30135/commits/32773cef4cfac87f13176a2767fabaeeecb5f3a2
15dd266 Address the failing Docs check arhadthedev Mar 4, 2023 https://github.com/python/cpython/pull/30135/commits/15dd2663ffd55f8f84aead2c0fd7568c1b405a8e
6898bc4 Merge branch 'python:main' into pprint_dict_view devdanzin Apr 6, 2024 https://github.com/python/cpython/pull/30135/commits/6898bc4695ec3f9e557b74716ceddd4130f59ed2
67e3f14 Add tests for collections.abc.[Keys|Items|Mapping|Values]View support… devdanzin Apr 7, 2024 https://github.com/python/cpython/pull/30135/commits/67e3f14c56c3b4cd0c39cd4edf7f8f0bb3d6a332
65e0be2 Add support for collections.abc.[Keys|Items|Mapping|Values]View in pp… devdanzin Apr 7, 2024 https://github.com/python/cpython/pull/30135/commits/65e0be20372e20fbc9c3e5651af37550b499c24a
c91af09 Split _pprint_dict_view into _pprint_abc_view, so pretty-printing nor… devdanzin Apr 7, 2024 https://github.com/python/cpython/pull/30135/commits/c91af096fa38a641da03fdf3c849dbfda7330f81
5b2341c Simplify redundant code. devdanzin Apr 7, 2024 https://github.com/python/cpython/pull/30135/commits/5b2341c11cd7c7de2b45eed25ae8469d3ebc193a
a9ff3df Add collections.abc views to some existing pprint tests. devdanzin Apr 7, 2024 https://github.com/python/cpython/pull/30135/commits/a9ff3dfdb8a40bb3b465ac2c1d5484a3a101e2be
4c67166 Remove TODO. devdanzin Apr 7, 2024 https://github.com/python/cpython/pull/30135/commits/4c6716650b13f15b6774ba0cc773a88e124d98d2
bfa9868 Test that views from collection.UserDict are correctly formatted by p… devdanzin Apr 7, 2024 https://github.com/python/cpython/pull/30135/commits/bfa9868e6524d8861983086a87561ea5125aa2b5
148b469 Handle recursive dict and ABC views. devdanzin Apr 7, 2024 https://github.com/python/cpython/pull/30135/commits/148b4690354bcefc11e8c14391ea7d5769415510
34abce7 Test that subclasses of ABC views work in pprint. devdanzin Apr 7, 2024 https://github.com/python/cpython/pull/30135/commits/34abce71c667554c999b7b6b0b86f2053f4a6e86
09839a6 Test dict views coming from collections.Counter. devdanzin Apr 7, 2024 https://github.com/python/cpython/pull/30135/commits/09839a60fc0e8d74687545c0aaeb80b31ce70fa1
091c3bb Test ABC views coming from collections.ChainMap. devdanzin Apr 7, 2024 https://github.com/python/cpython/pull/30135/commits/091c3bbe45c69fd003a4d2edadd246aba3451c59
29655a0 Test odict views coming from collections.OrderedDict. devdanzin Apr 7, 2024 https://github.com/python/cpython/pull/30135/commits/29655a03cc0d1943325e4b7f9cf9e2a78f8c767e
7ecb456 Merge branch 'main' into pprint_dict_view devdanzin Apr 8, 2024 https://github.com/python/cpython/pull/30135/commits/7ecb45607c8aaf95ddda6b66172f56eeda1ff327
646816a Rename _pprint_abc_view to _pprint_mapping_abc_view. devdanzin Apr 8, 2024 https://github.com/python/cpython/pull/30135/commits/646816ae4fc957366776acfb91549982749fc150
7537a52 Add pprint test for mapping ABC views where ._mapping has a custom __… devdanzin Apr 9, 2024 https://github.com/python/cpython/pull/30135/commits/7537a52a4e758180ad062aaff9e45ab6cc1392bb
7a6769d When a mapping ABC view has a ._mapping that defines a custom __repr_… devdanzin Apr 9, 2024 https://github.com/python/cpython/pull/30135/commits/7a6769d41f78a7f94e9bac095d4324fa2153dce4
7dcb9cf Merge branch 'python:main' into pprint_dict_view devdanzin Apr 9, 2024 https://github.com/python/cpython/pull/30135/commits/7dcb9cf9424dc37d60997fa422d102edbf96b39d
06babe4 Merge remote-tracking branch 'refs/remotes/origin/pprint_dict_view' i… devdanzin Apr 9, 2024 https://github.com/python/cpython/pull/30135/commits/06babe4611fd58e66b6742410a2fe49ebddf7fe9
58692d2 Add tests for ABC mapping views subclasses that don't replace __repr_… devdanzin Apr 21, 2024 https://github.com/python/cpython/pull/30135/commits/58692d2c4b67cc7d6f962fad8739d899f6281751
8e605c1 Simplify the pretty printing of ABC mapping views. devdanzin Apr 21, 2024 https://github.com/python/cpython/pull/30135/commits/8e605c1244133a7cad2ae33830ed86b56c7960ee
7e27e02 Merge branch 'python:main' into pprint_dict_view devdanzin Apr 21, 2024 https://github.com/python/cpython/pull/30135/commits/7e27e02643f9b0b111dcfbd1c58c8bb1a0c0f9c6
eb66934 Merge remote-tracking branch 'refs/remotes/origin/pprint_dict_view' i… devdanzin Apr 21, 2024 https://github.com/python/cpython/pull/30135/commits/eb66934360dcaa0c2314064481a74e470ef21480
1dc4ab2 Add a test for depth handling when pretty printing dict views. devdanzin Apr 21, 2024 https://github.com/python/cpython/pull/30135/commits/1dc4ab2fd1e24745e67634468f615576f42327e9
f267452 Fix checking whether the view type is a subclass of an items view, ad… devdanzin Apr 22, 2024 https://github.com/python/cpython/pull/30135/commits/f2674524ca8906b5b73874714457ede1c6c2719e
3867338 Move construction of the views __repr__ set out of _safe_repr. devdanzin Apr 26, 2024 https://github.com/python/cpython/pull/30135/commits/386733836cd4b023755ce2a9d9445ea5f77595f4
1a609d0 Merge branch 'main' into pprint_dict_view devdanzin Apr 26, 2024 https://github.com/python/cpython/pull/30135/commits/1a609d0953677f845c81405e8561ee29a13bca76
bca6f6f Merge remote-tracking branch 'refs/remotes/origin/pprint_dict_view' i… devdanzin Apr 26, 2024 https://github.com/python/cpython/pull/30135/commits/bca6f6f54df2ecb0cacc8bf9a63c0450cfc0ae2d
d020f86 Merge branch 'python:main' into pprint_dict_view devdanzin May 21, 2024 https://github.com/python/cpython/pull/30135/commits/d020f86dfb4b434f0533efab13e2c59415a97e8c
ee7b521 Merge branch 'python:main' into pprint_dict_view devdanzin May 30, 2024 https://github.com/python/cpython/pull/30135/commits/ee7b52196cbea7d794fb2c2675ce910975cfe58f
7009887 Merge branch 'python:main' into pprint_dict_view devdanzin Jul 1, 2024 https://github.com/python/cpython/pull/30135/commits/7009887aa22a653a67f6b034cc82ee62a0170bab
9499115 Merge branch 'main' into pprint_dict_view devdanzin Oct 29, 2024 https://github.com/python/cpython/pull/30135/commits/9499115925758e43c06ba644a2a521c301e23765
692c0cd Merge branch 'main' into pprint_dict_view AA-Turner Apr 20, 2025 https://github.com/python/cpython/pull/30135/commits/692c0cd8d139254f7447eb6631ebe7f12809fca2
90e069c Merge branch 'main' into pprint_dict_view gpshead May 20, 2025 https://github.com/python/cpython/pull/30135/commits/90e069c6c7e072c0ffdf5ed2d294f1863553a4a5
Clear filters https://github.com/python/cpython/pull/30135/files
Please reload this pagehttps://github.com/python/cpython/pull/30135/files
Please reload this pagehttps://github.com/python/cpython/pull/30135/files
pprint.py https://github.com/python/cpython/pull/30135/files#diff-2de5df6eb7096f61fad8ce401b98985b3e0f1c0710f82120b52b94df45f753be
test_pprint.py https://github.com/python/cpython/pull/30135/files#diff-6e84f83d1d30b8ae8cf576771368b4e513f0d4237089d9007df49d8395240956
2021-12-18-12-46-20.bpo-45959.vPlr3P.rst https://github.com/python/cpython/pull/30135/files#diff-55e47f6e7e5dea905626974ed85ff9095a2257becab7fe047c55f83edc9bcb0f
Lib/pprint.pyhttps://github.com/python/cpython/pull/30135/files#diff-2de5df6eb7096f61fad8ce401b98985b3e0f1c0710f82120b52b94df45f753be
View file https://github.com/devdanzin/cpython/blob/90e069c6c7e072c0ffdf5ed2d294f1863553a4a5/Lib/pprint.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/30135/{{ revealButtonHref }}
https://github.com/python/cpython/pull/30135/files#diff-2de5df6eb7096f61fad8ce401b98985b3e0f1c0710f82120b52b94df45f753be
Please reload this pagehttps://github.com/python/cpython/pull/30135/files
https://github.com/python/cpython/pull/30135/files#diff-2de5df6eb7096f61fad8ce401b98985b3e0f1c0710f82120b52b94df45f753be
https://github.com/python/cpython/pull/30135/files#diff-2de5df6eb7096f61fad8ce401b98985b3e0f1c0710f82120b52b94df45f753be
https://github.com/python/cpython/pull/30135/files#diff-2de5df6eb7096f61fad8ce401b98985b3e0f1c0710f82120b52b94df45f753be
Please reload this pagehttps://github.com/python/cpython/pull/30135/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.