[Python-Dev] Updates to PEP 471, the os.scandir() proposal

Ben Hoyt benhoyt at gmail.com
Wed Jul 9 15:12:24 CEST 2014

> Ok, so it means that your example grouping files per type, files and
> directories, is also wrong. Or at least, it behaves differently than
> os.walk(). You should put symbolic links to directories in the "dirs"
> list too.
> if entry.is_dir():   # is_dir() checks os.lstat()
>     dirs.append(entry)
> elif entry.is_symlink() and os.path.isdir(entry):   # isdir() checks os.stat()
>     dirs.append(entry)
> else:
>     non_dirs.append(entry)

Yes, good call. I believe I'm doing this wrong in the scandir.py
os.walk() implementation too -- hence this open issue:


More information about the Python-Dev mailing list