◐ Shell
clean mode source ↗

GH-77609: Support following symlinks in `pathlib.Path.glob()` by barneygale · Pull Request #104176 · python/cpython

@barneygale

Marking as a draft because it would be good to land #104292 and #104141 first.

@zooba

How does this help us fix the mixed up behaviour of the current function?

@barneygale

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.

@zooba

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).

@barneygale

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.

@barneygale