GeezerVison is showing github.com — GH-77609: Support following symlinks in `pathlib.Path.glob()` by barneygale · Pull Request #104176 · python/cpython
Conversation
barneygale
commented
May 4, 2023
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Add support for *** wildcard in pathlib.Path.glob() and rglob(). This wildcard works like **, except that it also recurses into symlinks.
See Recursive Globbing in the zshexpn manpage for prior art.
Alternative to #102616
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Marking as a draft because it would be good to land #104292 and #104141 first.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
How does this help us fix the mixed up behaviour of the current function?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I don't think the current behaviour is wrong, just difficult to optimize. With this PR, users would be able to recursively walk symlinks, and we'd be able to optimize ***/*.py later on (but not **/*.py). Still, I'm not convinced this is the right way forward.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Still, I'm not convinced this is the right way forward.
I'm surprised, because you closed the other PR saying you were convinced this was the way forward.
Personally, I preferred the other way. It's a bit more work, but in ~5 years time we'll have forgotten about it and will just have sensible defaults. Adding this way and leaving the other one leaves us with two warts (okay, maybe 1.5, if people like this, but I feel like special patterns specifically for symlinks is too much).
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Still, I'm not convinced this is the right way forward.
I'm surprised, because you closed the other PR saying you were convinced this was the way forward.
I know. I literally changed my mind again last night while playing around with the glob() implementation! :P
Personally, I preferred the other way. It's a bit more work, but in ~5 years time we'll have forgotten about it and will just have sensible defaults. Adding this way and leaving the other one leaves us with two warts (okay, maybe 1.5, if people like this, but I feel like special patterns specifically for symlinks is too much).
👍 fair point, thanks for the advice.
|
zooba reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|