Skip to content

GH-125413: Revert addition of pathlib.Path.scandir() method - #127377

Merged
barneygale merged 4 commits into
python:mainfrom
barneygale:scandir-revert
Dec 5, 2024
Merged

GH-125413: Revert addition of pathlib.Path.scandir() method#127377
barneygale merged 4 commits into
python:mainfrom
barneygale:scandir-revert

Conversation

@barneygale

@barneygalebarneygale commented Nov 29, 2024

Copy link
Copy Markdown
Contributor

Remove documentation for pathlib.Path.scandir(), and rename the method to _scandir(). In the private pathlib ABCs, make iterdir() abstract and call it from _scandir().

It's not worthwhile to add this method at the moment - see discussion: https://discuss.python.org/t/ergonomics-of-new-pathlib-path-scandir/71721


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

Remove documentation for `pathlib.Path.scandir()`, and rename the method to
`_scandir()`. In the private pathlib ABCs, make `iterdir()` abstract and
call it from `_scandir()`.
It's not worthwhile to add this method at the moment - see discussion:
https://discuss.python.org/t/ergonomics-of-new-pathlib-path-scandir/71721

@zoobazooba left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I think we need a bit more code duplication in order to keep subclassing reliable.

Comment threadLib/pathlib/_abc.py
Comment threadLib/pathlib/_abc.py
Comment threadLib/pathlib/_abc.py
Comment threadMisc/NEWS.d/next/Library/2024-11-29-00-15-59.gh-issue-125413.WCN0vv.rst Outdated
@barneygale

Copy link
Copy Markdown
ContributorAuthor

@zooba would you mind if I tackle removing _scandir() in a follow-up PR?

@zooba

zooba commented Dec 5, 2024

Copy link
Copy Markdown
Member

Sure. Provided it's not part of the public/subclassing interface, I'm happy.

barneygaleand others added 2 commits December 5, 2024 21:11
…CN0vv.rst
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
@barneygale
barneygale requested a review from zoobaDecember 5, 2024 21:27
@barneygale
barneygale enabled auto-merge (squash) December 5, 2024 21:36
@barneygale
barneygale merged commit 8b3cccf into python:mainDec 5, 2024
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Jan 8, 2025
…ython#127377)
Remove documentation for `pathlib.Path.scandir()`, and rename the method to
`_scandir()`. In the private pathlib ABCs, make `iterdir()` abstract and
call it from `_scandir()`.
It's not worthwhile to add this method at the moment - see discussion:
https://discuss.python.org/t/ergonomics-of-new-pathlib-path-scandir/71721
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
Sign up for freeto 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.

2 participants

@barneygale@zooba