[Python-Dev] PEP 428: Pathlib -> stat caching (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Mon Sep 16 21:45:36 CEST 2013


On Mon, 16 Sep 2013 19:06:37 +0200 Charles-François Natali <cf.natali at gmail.com> wrote:

2013/9/16 Antoine Pitrou <solipsis at pitrou.net>: > Le Sun, 15 Sep 2013 06:46:08 -0700, > Ethan Furman <ethan at stoneleaf.us> a écrit : >> I see PEP 428 is both targeted at 3.4 and still in draft status. >> >> What remains to be done to ask for pronouncement? > > I think I have a couple of items left to integrate in the PEP. > Mostly it needs me to take a bit of time and finalize the PEP, and > then have a PEP delegate (or Guido) pronounce on it.

IIRC, during the last discussion round, we were still debating between implicit stat() result caching - which requires an explicit restat() method - vs a mapping between the stat() method and a stat() syscall. What was the conclusion?

No definite conclusion. You and Nick liked the idea of a rich stat object (returned by os.stat()) with is_dir() methods and the like: https://mail.python.org/pipermail/python-dev/2013-May/125809.html

However, nothing was done about that since then ;-)

There was also the scandir() proposal to return rich objects with optional stat-like fields, but similarly it didn't get a conclusion: https://mail.python.org/pipermail/python-dev/2013-May/126119.html

So I would like to propose the following API change:

In other words, only if you use cache_stat() at least once is the stat() value cached and reused by the Path object. (also, it's a per-Path decision)

Regards

Antoine.



More information about the Python-Dev mailing list