Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed as not planned
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
Because we have os.path.exists() & os.path.lexists(), it might make sense to add a follow_symlinks argument to the former:
-def exists(path):+def exists(path, *, follow_symlinks=True): """Test whether a path exists. Returns False for broken symbolic links""" try: - os.stat(path)+ os.stat(path, follow_symlinks=follow_symlinks) except (OSError, ValueError): return False return TrueThis matches pathlib.Path.exists()(as well as os.stat() & os.chmod()).Also, it looks like (but that's less explicit and so unnecessary, see #21157 (comment))pathlib.Path doesn't have an lexists() function.
Note: this argument also needs to be added to Done.nt._path_exists().
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement