Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
GH-101362: Omit path anchor frompathlib.PurePath()._parts
#102476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
GH-101362: Omit path anchor frompathlib.PurePath()._parts
#102476
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Improve performance of path construction by skipping the addition of thepath anchor (`drive + root`) to the internal `_parts` list. This changeallows us to simplify the implementations of `joinpath()`, `name`,`parent`, and `parents` a little. The public `parts` tuple is unaffected.
barneygale commentedMar 6, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I'm not sure about this change - I don't like how it makes edit: addressed by renaming |
barneygale commentedMar 12, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
barneygale commentedApr 3, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Updated timings:
Something like a 10% speedup. |
Uh oh!
There was an error while loading.Please reload this page.
…ythonGH-102476)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.
…ythonGH-102476)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.
`pathlib.Path._parts` has been removed in Python 3.12:python/cpython#102476Switch to pathlib.Path.parts which is a tuple.Closes#1934
`pathlib.Path._parts` has been removed in Python 3.12:python/cpython#102476Switch to pathlib.Path.parts which is a tuple.Closes#1934
`pathlib.Path._parts` has been removed in Python 3.12:python/cpython#102476Switch to pathlib.Path.parts which is a tuple.Closes#1934
`pathlib.Path._parts` has been removed in Python 3.12:python/cpython#102476Switch to pathlib.Path.parts which is a tuple.Closes#1934
`pathlib.Path._parts` has been removed in Python 3.12:python/cpython#102476Switch to pathlib.Path.parts which is a tuple.Closes#1934
Uh oh!
There was an error while loading.Please reload this page.
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:
name
,parent
, andparents
a little._make_child_relpath()
by building the new string path with naive string concatination rather than_format_parsed_parts()
.__hash__()
and__eq__()
by referring to theunsplit case-normalized path.__lt__()
etc by referring to thenaively split case-normalized path (i.e. split onsep
without consideration of anchor)The public
parts
tuple is unaffected.