On Mon, 25 Nov 2013 11:20:08 +1300 Ben Hoyt <benh...@gmail.com> wrote: > > This mainly depends on how Path is going to cache stat information. If > it caches it, then this will just work. Sounds like Guido's opinion > was that both cached and uncached use cases are important, but that it > should be very clear which one you're getting. I personally like the > .stat() and .restat() idea.
Right now, pathlib doesn't cache. Guido decided it was safer to start off like that, and perhaps later we can add some optional caching. One reason caching didn't go in is that it's not clear which API is best. Working on pluggin scandir() into pathlib would actually help choosing a stat-caching API. (or, rather, lstat-caching...) > The other related thing is that DirEntry only provides .lstat(), > because it's providing stat-like info without following links. Path.is_dir() and friends use stat(), i.e. they inform you about whether a symlink's target is a directory (not the symlink itself). Of course, if the DirEntry says the path is a symlink, Path.is_dir() could then run stat() to find out about the target. Do you plan to propose scandir() for inclusion in the stdlib? Regards Antoine. _______________________________________________ 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