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

bpo-46316: optimize pathlib.Path.iterdir() #30501

Merged

Conversation

barneygale
Copy link
Contributor

@barneygale barneygale commented Jan 9, 2022

os.listdir() doesn't return entries for . or .., so we don't need to check for them here.

See https://docs.python.org/3/library/os.html#os.listdir

Return a list containing the names of the entries in the directory given by path. The list is in arbitrary order, and does not include the special entries '.' and '..' even if they are present in the directory.

https://bugs.python.org/issue46316

`os.listdir()` doesn't return entries for `.` or `..`, so we don't need to
check for them here.

See https://docs.python.org/3/library/os.html#os.listdir
Copy link
Member

@zware zware left a comment

Choose a reason for hiding this comment

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

LGTM; confirmed that both implementations of listdir explicitly elide . and .., and it doesn't look like self._accessor.listdir can be anything other than os.listdir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance or resource usage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants