- I am not sure it going to be obvious that
Path.info
is cached by design to many users. This will have to be documented in bold and then underlined 100 times. - It’s adding a bit of entropy. There’s now
p.is_dir()
andp.info.is_dir()
amongst other methods. - Python is so terse, I’m not sure that
s = p.stat()
was really a big deal. It’s explicit and obvious. WasPath.stat(cache=True)
considered? - Internally, pathlib needs to be careful when it’s calling
.info
. Methods likecopy
andcopy_info/from
need to be clear why they are using a cached values. - The “sugar” layer of taking the output of
os.stat()
and translating it to more digestible form/types (e.g., Datetime, Permissions, Mode) is a stellar addition. - Currently, if you want the sugar-ized output of
os.stat
, but not the caching, you’re out of luck? I suspect people will start usingPath.info
for the sugar but not realizing it’s cached. - For the case of
follow_symlinks=False
, don’t you have to repeatedly callp.info.exists(follow_symlinks=False); p.info.is_dir(follow_symlinks=False)
? This isn’t particularly ergonomic?
It’s a bit too late, but I would have advocated for something that is more symmetric with info
and stat
and that is not cached by default.
Path.stat(follow_symlinks=True, cache=False)
to enable caching of stat callPath.info(follow_symlinks=True, cache=False)
withinfo
having a sugar-ized stat output as well asis_dir()
and friends that that can be optionally cached.