Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve pathlib.Path.iterdir docstring #98832

Closed
sobolevn opened this issue Oct 28, 2022 · 1 comment
Closed

Improve pathlib.Path.iterdir docstring #98832

sobolevn opened this issue Oct 28, 2022 · 1 comment
Assignees
Labels
stdlib Python modules in the Lib dir topic-pathlib

Comments

@sobolevn
Copy link
Member

sobolevn commented Oct 28, 2022

Right now it says:

cpython/Lib/pathlib.py

Lines 871 to 876 in e089f23

def iterdir(self):
"""Iterate over the files in this directory. Does not yield any
result for the special paths '.' and '..'.
"""
for name in os.listdir(self):
yield self._make_child_relpath(name)

This part is confusing:

Does not yield any result for the special paths '.' and '..'

It might be understood as Path('.').iterdir() not yileding any results.

I think, that it would be better to use the exact same wording as in docs: https://docs.python.org/3/library/pathlib.html#pathlib.Path.iterdir

the special entries '.' and '..' are not included.

I will send a PR.

@sobolevn sobolevn added docs Documentation in the Doc dir stdlib Python modules in the Lib dir topic-pathlib labels Oct 28, 2022
@sobolevn sobolevn self-assigned this Oct 28, 2022
sobolevn added a commit to sobolevn/cpython that referenced this issue Oct 28, 2022
@AlexWaygood AlexWaygood removed the docs Documentation in the Doc dir label Oct 30, 2022
miss-islington pushed a commit that referenced this issue Nov 9, 2022
…8833)

Found while working on #98829

Automerge-Triggered-By: GH:AlexWaygood
@AlexWaygood
Copy link
Member

Thanks @sobolevn!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir topic-pathlib
Projects
None yet
Development

No branches or pull requests

2 participants