-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-101112: Add "pattern language" section to pathlib docs #114030
Conversation
Explain the `match()` / `glob()` / `rglob()` pattern language in its own section. Move `rglob()` documentation under `glob()` and reduce duplicated text.
How patterns with trailing slashes should work:
However pathlib's implementation of globbing only supports (1), and it's more-or-less impossible to support (2) and (3) in a backwards-compatible way. Because of this, I've not documented trailing slashes in this PR. Too many caveats. They get a mention in the See also: #106747 |
Maybe it's worth mentioning that trailing slashes are currently inconsistent and to check individual docs, but also recommend a way to use them consistently so that as we make fixes, you're less likely to be affected? e.g. if we'd been telling people "yeah, |
Honestly I think it's a dead end given the strength of feeling in this thread: https://discuss.python.org/t/pathlib-preserve-trailing-slash/33389 The only possible avenue I see is that we introduce a new class like |
By the logic I see there, Since we're talking about a pattern here, rather than a path, I think it's okay for |
I agree that making trailing slashes meaningful to patterns in ... but at least it only affects |
I've added a couple of paragraphs that attempts to explain how trailing slashes work, lmk what you think? |
Is it worth adding a "Comparison to
It could also note that pathlib's implementation is heckin' fast |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few minor suggestions, but looks good.
Thanks for the review, Steve. |
…on#114030) Explain the `full_match()` / `glob()` / `rglob()` pattern language in its own section. Move `rglob()` documentation under `glob()` and reduce duplicated text.
…on#114030) Explain the `full_match()` / `glob()` / `rglob()` pattern language in its own section. Move `rglob()` documentation under `glob()` and reduce duplicated text.
…on#114030) Explain the `full_match()` / `glob()` / `rglob()` pattern language in its own section. Move `rglob()` documentation under `glob()` and reduce duplicated text.
Explain the
full_match()
/glob()
/rglob()
pattern language in its own section. Moverglob()
documentation underglob()
and reduce duplicated text.Path.rglob
-> documentation does not specify whatpattern
is #101112📚 Documentation preview 📚: https://cpython-previews--114030.org.readthedocs.build/