-
-
Notifications
You must be signed in to change notification settings - Fork 34.1k
gh-144835: Added missing explanations for some parameters in glob and iglob. #144836
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
Open
facundobatista
wants to merge
4
commits into
python:main
Choose a base branch
from
facundobatista:improve-globglob-docstrings
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+21
−0
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
abb4ca7
Added missing explanations for some parameters in glob and iglob.
facundobatista 7c16dc8
News entry.
facundobatista 1aa3725
Merge branch 'main' into improve-globglob-docstrings
facundobatista 917fc00
Added proper 'func' indication in News file.
facundobatista File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -25,6 +25,14 @@ def glob(pathname, *, root_dir=None, dir_fd=None, recursive=False, | |||||||||||||||||||||||||||||||||||||||||
| The order of the returned list is undefined. Sort it if you need a | ||||||||||||||||||||||||||||||||||||||||||
| particular order. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| If root_dir is not None, it should be a path-like object specifying the | ||||||||||||||||||||||||||||||||||||||||||
| root directory for searching. It has the same effect as changing the | ||||||||||||||||||||||||||||||||||||||||||
| current directory before calling it. If pathname is relative, the | ||||||||||||||||||||||||||||||||||||||||||
| result will contain paths relative to root_dir. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| If dir_fd is not None, it should be a file descriptor referring to a | ||||||||||||||||||||||||||||||||||||||||||
| directory, and paths will then be relative to that directory. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| If `include_hidden` is true, the patterns '*', '?', '**' will match hidden | ||||||||||||||||||||||||||||||||||||||||||
| directories. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -46,6 +54,17 @@ def iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False, | |||||||||||||||||||||||||||||||||||||||||
| The order of the returned paths is undefined. Sort them if you need a | ||||||||||||||||||||||||||||||||||||||||||
| particular order. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| If root_dir is not None, it should be a path-like object specifying the | ||||||||||||||||||||||||||||||||||||||||||
| root directory for searching. It has the same effect as changing the | ||||||||||||||||||||||||||||||||||||||||||
| current directory before calling it. If pathname is relative, the | ||||||||||||||||||||||||||||||||||||||||||
| result will contain paths relative to root_dir. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| If dir_fd is not None, it should be a file descriptor referring to a | ||||||||||||||||||||||||||||||||||||||||||
| directory, and paths will then be relative to that directory. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| If `include_hidden` is true, the patterns '*', '?', '**' will match hidden | ||||||||||||||||||||||||||||||||||||||||||
| directories. | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+57
to
+66
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should be consistent with backticks for args, either use for all or none. I do see that PyCharm shows them in italics, so there is a benefit to using them as it makes the text more readable:
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| If recursive is true, the pattern '**' will match any files and | ||||||||||||||||||||||||||||||||||||||||||
| zero or more directories and subdirectories. | ||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
2 changes: 2 additions & 0 deletions
2
Misc/NEWS.d/next/Library/2026-02-15-12-02-20.gh-issue-144835.w_oS_J.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Added missing explanations for some parameters in :func:`glob.glob` and | ||
| :func:`glob.iglob`. |
Oops, something went wrong.
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.

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.
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.
I'm wary of "It has the same effect as changing the current directory before calling it" phrasing as we don't want anyone to think that the process wide global cwd is changed by these API calls. I think it may be better to state what the default behavior is when not specified or None. ie "if not specified or None, the search will be conducted from the processes current working directory and returned paths will be relative to that" (Q: is that accurate?)