-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Open
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-pathlibtype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
I propose we add a pathlib.Path.metadata()
method that requires a keyword-only cached argument, e.g.:
>>> m = pathlib.Path('README.txt').metadata(cached=True)
>>> m
Metadata('README.txt')
>>> m.is_file()
True
If cached is True
, the method may return a Metadata
object that was previously fetched and cached. If False
, the return value is always up-to-date.
pathlib.Path.info
should be soft-deprecated; its implementation should call self.metadata(cached=True)
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
https://discuss.python.org/t/ergonomics-of-new-pathlib-path-scandir/71721/70
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-pathlibtype-featureA feature request or enhancementA feature request or enhancement