Skip to content

Improve pathlib.Path.iterdir docstring #98832

@sobolevn

Description

@sobolevn

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.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions