Repository navigation
Add Path.lexist() to pathlib #78318
Description
Activity
When using pathlib to manipulate paths that may be symlinks or regular files, a pattern that comes up frequently is this expression:
path.is_symlink() or path.exists()
os.path.lexists(path) can be used for this, but when using pathlib going back to os.path for this seems like defeat.
- added3.7 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
on Jul 17, 2018 I haven't contributed to Python yet and I can contribute this as a way for me to practice the PR process in Python.
As this is a small addition, should I create a PR right away, or wait for a consensus here?
If you're okay with the PR being rejected because the decision is the method isn't desired, then feel free to go ahead and create a PR, Engin! But if you want to a better chance that it will eventually go in then I would wait for consensus.
Thanks for the response Brett! I am not going to rush, then. But if I happen to have some free time and motivation to create the PR, I will just do it. I don't mind revising or getting rejected.
I've come across this issue lately and proposed a PR which implements this and, analogous to os.stat(), adds a follow_symlinks parameter to Path.exists().
Closing as rejected -- see comments on the PR: #21157 (comment)
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields: