> 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: https://github.com/benhoyt/scandir/issues/4 -Ben _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com