[New-bugs-announce] [issue46316] Optimize pathlib.Path.iterdir()
Barney Gale
report at bugs.python.org
Sun Jan 9 09:52:52 EST 2022
New submission from Barney Gale <barney.gale at gmail.com>:
pathlib.Path.iterdir() contains the following code:
if name in {'.', '..'}:
# Yielding a path object for these makes little sense
continue
This check is unnecessary as os.listdir() does not return entries for '.' or '..':
os.listdir(path='.')
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
See https://docs.python.org/3/library/os.html#os.listdir
----------
components: Library (Lib)
messages: 410154
nosy: barneygale
priority: normal
severity: normal
status: open
title: Optimize pathlib.Path.iterdir()
versions: Python 3.11
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46316>
_______________________________________
More information about the New-bugs-announce
mailing list