Skip to content

GH-131916: Add pathlib.PurePath.segments#131917

Closed
barneygale wants to merge 2 commits intopython:mainfrom
barneygale:gh-131916
Closed

GH-131916: Add pathlib.PurePath.segments#131917
barneygale wants to merge 2 commits intopython:mainfrom
barneygale:gh-131916

Conversation

@barneygale
Copy link
Copy Markdown
Contributor

@barneygale barneygale commented Mar 30, 2025

Add pathlib.PurePath.segments attribute, which stores the flattened path segments given to the path object initializer.

In the pathlib ABCs, add JoinablePath.segments as an abstract attribute, and convert JoinablePath.__str__() from an abstract method to a mixin method that joins self.segments.


📚 Documentation preview 📚: https://cpython-previews--131917.org.readthedocs.build/

Add `pathlib.PurePath.segments` attribute, which stores the flattened path
segments given to the path object initializer.

In the pathlib ABCs, add `JoinablePath.segments` as an abstract attribute,
and convert `JoinablePath.__str__()` from an abstract method to a mixin
method that joins `self.segments`.
This applies to tons of attributes
@barneygale barneygale marked this pull request as ready for review March 30, 2025 19:56
@barneygale barneygale requested a review from encukou March 30, 2025 19:56
@python-cla-bot
Copy link
Copy Markdown

python-cla-bot Bot commented Apr 6, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@barneygale barneygale closed this May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant