René's URL Explorer Experiment


Title: GH-101362: Omit path anchor from `pathlib.PurePath()._parts` by barneygale · Pull Request #102476 · python/cpython · GitHub

Open Graph Title: GH-101362: Omit path anchor from `pathlib.PurePath()._parts` by barneygale · Pull Request #102476 · python/cpython

X Title: GH-101362: Omit path anchor from `pathlib.PurePath()._parts` by barneygale · Pull Request #102476 · python/cpython

Description: Improve performance of path construction by skipping the addition of the path anchor (drive + root) to the internal _parts list. Rename this attribute to _tail for clarity. Also: Simplify the implementations of name, parent, and parents a little. Optimize _make_child_relpath() by building the new string path with naive string concatination rather than _format_parsed_parts(). Optimize __hash__() and __eq__() by referring to the unsplit case-normalized path. Optimize __lt__() etc by referring to the naively split case-normalized path (i.e. split on sep without consideration of anchor) The public parts tuple is unaffected. $ ./python -m timeit -s 'from pathlib import PureWindowsPath as P' 'P("C:/foo/bar.py")' 100000 loops, best of 5: 1.98 usec per loop # before 200000 loops, best of 5: 1.75 usec per loop # after Issue: gh-101362

Open Graph Description: Improve performance of path construction by skipping the addition of the path anchor (drive + root) to the internal _parts list. Rename this attribute to _tail for clarity. Also: Simplify the impl...

X Description: Improve performance of path construction by skipping the addition of the path anchor (drive + root) to the internal _parts list. Rename this attribute to _tail for clarity. Also: Simplify the impl...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:250a97fa-f204-f835-7840-edec0e2fc34a
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idDF66:3CA024:3BD34:54E89:696A0BB7
html-safe-nonce17726fa75e495eaa183f5c7819f7af027561dfc7bae3db414e5d41deff064989
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjY2OjNDQTAyNDozQkQzNDo1NEU4OTo2OTZBMEJCNyIsInZpc2l0b3JfaWQiOiI4NTMwNDExOTE3NjE4NTgwNDA3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac614eef43bc0aa38aee48e098660a674e29aead4bd59549274f467930a59fa65e
hovercard-subject-tagpull_request:1264960957
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/102476/files
twitter:imagehttps://avatars.githubusercontent.com/u/960340?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/960340?s=400&v=4
og:image:altImprove performance of path construction by skipping the addition of the path anchor (drive + root) to the internal _parts list. Rename this attribute to _tail for clarity. Also: Simplify the impl...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None699227a00bbb7fe1eec276d2ae1c3a93068bc5ba483bd9dc4b2a27a8f4f2f595
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
release7266b2d935baa1c6474b16dd9feaa5ca30607261
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/102476/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F102476%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F102476%2Ffiles
Sign up https://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/102476/files
Reloadhttps://github.com/python/cpython/pull/102476/files
Reloadhttps://github.com/python/cpython/pull/102476/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/102476/files
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/pull/102476/files
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
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
barneygalehttps://github.com/barneygale
python:mainhttps://github.com/python/cpython/tree/main
barneygale:gh-101362-exclude-anchor-from-partshttps://github.com/barneygale/cpython/tree/gh-101362-exclude-anchor-from-parts
Conversation 6 https://github.com/python/cpython/pull/102476
Commits 13 https://github.com/python/cpython/pull/102476/commits
Checks 0 https://github.com/python/cpython/pull/102476/checks
Files changed https://github.com/python/cpython/pull/102476/files
Please reload this pagehttps://github.com/python/cpython/pull/102476/files
GH-101362: Omit path anchor from pathlib.PurePath()._parts https://github.com/python/cpython/pull/102476/files#top
Show all changes 13 commits https://github.com/python/cpython/pull/102476/files
8bf4600 GH-101362: Omit path anchor from `pathlib.PurePath()._parts` barneygale Mar 6, 2023 https://github.com/python/cpython/pull/102476/commits/8bf4600d524fc3e1f6bdad10843b06805f870c0d
e7a58c3 Add news blurb. barneygale Mar 6, 2023 https://github.com/python/cpython/pull/102476/commits/e7a58c33f1a8f12d0c264cc222f7cacb6345d30b
1d58aed Rename `_parts` to `_tail` for clarity. barneygale Mar 6, 2023 https://github.com/python/cpython/pull/102476/commits/1d58aeda3fe46f4a62aaf2554402e2bdc834c6ec
ac26f84 Merge branch 'main' into gh-101362-exclude-anchor-from-parts barneygale Mar 10, 2023 https://github.com/python/cpython/pull/102476/commits/ac26f8474c54e09b7e9c85f7afb7be066e1286af
cce5d7b Undo some changes to _format_parsed_parts() barneygale Mar 10, 2023 https://github.com/python/cpython/pull/102476/commits/cce5d7ba5087120f742b3b213a8165fc9b8108c2
f529d51 Merge branch 'main' into gh-101362-exclude-anchor-from-parts barneygale Apr 3, 2023 https://github.com/python/cpython/pull/102476/commits/f529d5136eb2d9c2e375220d6fc770a8e4771f45
0c0f5bd Move `str()` call out of initialiser. barneygale Apr 3, 2023 https://github.com/python/cpython/pull/102476/commits/0c0f5bd6ec2c6779cf2b80d220f18bc1cd83f770
7a4e92f Optimize `_make_child_relpath()` barneygale Apr 3, 2023 https://github.com/python/cpython/pull/102476/commits/7a4e92fdf1d87d5f6b560c118e3ce827082619cd
c8d4b38 Remove caching of `Path.parts` barneygale Apr 3, 2023 https://github.com/python/cpython/pull/102476/commits/c8d4b384e6106cb486c5f5e4cf1be1fc99225ebf
d2a578d Cache case-normalized string. barneygale Apr 6, 2023 https://github.com/python/cpython/pull/102476/commits/d2a578db100e7aa50212e9ca6f31433a4c36aad2
de4df7a Rename `_make_child` back to `_make_child_relpath` barneygale Apr 7, 2023 https://github.com/python/cpython/pull/102476/commits/de4df7adb6efdc9721ba8bdd8a9b8017812f6199
5a34f7e Add comments to `PurePath.__slots__` barneygale Apr 8, 2023 https://github.com/python/cpython/pull/102476/commits/5a34f7e3046e158597e450249cf1b1d6f8a74940
078ced9 Merge branch 'main' into gh-101362-exclude-anchor-from-parts barneygale Apr 9, 2023 https://github.com/python/cpython/pull/102476/commits/078ced9c8934d4bbb94c282c798c13a51bc13c38
Clear filters https://github.com/python/cpython/pull/102476/files
Please reload this pagehttps://github.com/python/cpython/pull/102476/files
Please reload this pagehttps://github.com/python/cpython/pull/102476/files
pathlib.py https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
test_pathlib.py https://github.com/python/cpython/pull/102476/files#diff-3dd97d2dc8816848d0b0c442e8fdeec9650b3de77935289a93f37ac6396ee17f
2023-03-06-18-49-57.gh-issue-101362.eSSy6L.rst https://github.com/python/cpython/pull/102476/files#diff-efaff55e25cc3630d8f73525b47e454d7b154eacec827d8a9cb30ad73e75febf
Lib/pathlib.pyhttps://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
View file https://github.com/barneygale/cpython/blob/078ced9c8934d4bbb94c282c798c13a51bc13c38/Lib/pathlib.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/102476/{{ revealButtonHref }}
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
https://github.com/python/cpython/pull/102476/files#diff-fa525485738fc33d05b06c159172ff1f319c26e88d8c6bb39f7dbaae4dc4105c
Lib/test/test_pathlib.pyhttps://github.com/python/cpython/pull/102476/files#diff-3dd97d2dc8816848d0b0c442e8fdeec9650b3de77935289a93f37ac6396ee17f
View file https://github.com/barneygale/cpython/blob/078ced9c8934d4bbb94c282c798c13a51bc13c38/Lib/test/test_pathlib.py
Open in desktop https://desktop.github.com
Please reload this pagehttps://github.com/python/cpython/pull/102476/files
https://github.co/hiddenchars
https://github.com/python/cpython/pull/102476/{{ revealButtonHref }}
https://github.com/python/cpython/pull/102476/files#diff-3dd97d2dc8816848d0b0c442e8fdeec9650b3de77935289a93f37ac6396ee17f
https://github.com/python/cpython/pull/102476/files#diff-3dd97d2dc8816848d0b0c442e8fdeec9650b3de77935289a93f37ac6396ee17f
Misc/NEWS.d/next/Library/2023-03-06-18-49-57.gh-issue-101362.eSSy6L.rsthttps://github.com/python/cpython/pull/102476/files#diff-efaff55e25cc3630d8f73525b47e454d7b154eacec827d8a9cb30ad73e75febf
View file https://github.com/barneygale/cpython/blob/078ced9c8934d4bbb94c282c798c13a51bc13c38/Misc/NEWS.d/next/Library/2023-03-06-18-49-57.gh-issue-101362.eSSy6L.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/102476/{{ revealButtonHref }}
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.