New submission from Barney Gale <barney.g...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue46316>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to