[Python-Dev] Updates to PEP 471, the os.scandir() proposal
benhoyt at gmail.com
Wed Jul 9 17:29:21 CEST 2014
>> The PEP says that DirEntry should mimic pathlib.Path, so I think that
>> DirEntry.is_dir() should work as os.path.isir(): if the entry is a
>> symbolic link, you should follow the symlink to get the status of the
>> linked file with os.stat().
> Would this not "break" the tree size script being discussed in the
> other thread, as it would follow links and include linked directories
> in the "size" of the tree?
Yeah, I agree. Victor -- I don't think the DirEntry is_X() methods (or
attributes) should mimic the link-following os.path.isdir() at all.
You want the type of the entry, not the type of the source.
Otherwise, as Paul says, you are essentially forced to follow links,
and os.walk(followlinks=False), which is the default, can't do the
More information about the Python-Dev