classification
Title: Add Path.lexist() to pathlib
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: apatrushev, brett.cannon, e-kayrakli, lordmauve, nils, xtreak
Priority: normal Keywords: patch

Created on 2018-07-17 10:59 by lordmauve, last changed 2020-06-25 15:50 by nils.

Pull Requests
URL Status Linked Edit
PR 21157 open nils, 2020-06-25 15:40
Messages (5)
msg321812 - (view) Author: Daniel Pope (lordmauve) * Date: 2018-07-17 10:59
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.
msg321820 - (view) Author: Engin Kayraklioglu (e-kayrakli) Date: 2018-07-17 12:53
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?
msg321913 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2018-07-18 20:00
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.
msg321915 - (view) Author: Engin Kayraklioglu (e-kayrakli) Date: 2018-07-18 20:26
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.
msg372378 - (view) Author: Nils Philippsen (nils) * Date: 2020-06-25 15:50
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().
History
Date User Action Args
2020-06-25 15:50:44nilssetmessages: + msg372378
2020-06-25 15:40:59nilssetkeywords: + patch
stage: patch review
pull_requests: + pull_request20316
2020-06-25 10:34:17nilssetnosy: + nils
2018-07-27 01:59:22apatrushevsetnosy: + apatrushev
2018-07-18 20:26:27e-kayraklisetmessages: + msg321915
2018-07-18 20:00:35brett.cannonsetnosy: + brett.cannon
messages: + msg321913
2018-07-17 12:53:28e-kayraklisetnosy: + e-kayrakli
messages: + msg321820
2018-07-17 11:47:27xtreaksetnosy: + xtreak
2018-07-17 10:59:41lordmauvecreate