>> 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 right thing. -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