Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.2k
gh-144835: Added missing explanations for some parameters in glob and iglob.#144836
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Lib/glob.py Outdated
| 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. |
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.
| Ifroot_dirisnotNone,itshouldbeapath-likeobjectspecifyingthe | |
| rootdirectoryforsearching.Ithasthesameeffectaschangingthe | |
| currentdirectorybeforecallingit.Ifpathnameisrelative,the | |
| resultwillcontainpathsrelativetoroot_dir. | |
| Ifdir_fdisnotNone,itshouldbeafiledescriptorreferringtoa | |
| directory,andpathswillthenberelativetothatdirectory. | |
| If`root_dir`isnotNone,itshouldbeapath-likeobjectspecifyingthe | |
| rootdirectoryforsearching.Ithasthesameeffectaschangingthe | |
| currentdirectorybeforecallingit.If`pathname`isrelative,the | |
| resultwillcontainpathsrelativetoroot_dir. | |
| If`dir_fd`isnotNone,itshouldbeafiledescriptorreferringtoa | |
| directory,andpathswillthenberelativetothatdirectory. |
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?)
terryjreedy left a comment
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 agree with Hugo's suggestions, and yes, backport.
When you're done making the requested changes, leave the comment: |
facundobatista commentedFeb 18, 2026
@hugovk@terryjreedy I have made the requested changes; please review again, thanks!! |
Thanks for making the requested changes! @terryjreedy: please review the changes made to this pull request. |
facundobatista commentedFeb 18, 2026
@gpshead I understand your concern. I'm using the same wording that in theglob documentation. Maybe we can improve both? I prefer the "positive description" (indicate what it does, not what it doesn't). What about the following clarification? Thanks! |
facundobatista commentedMar 1, 2026
@hugovk@terryjreedy@gpshead hey! let me know please if you need something else is needed before I go forward with merging this. Thanks! |
Uh oh!
There was an error while loading.Please reload this page.
facundobatista commentedMar 2, 2026
@gpshead thanks! |
e542255 intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@facundobatista for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…ob and iglob. (pythonGH-144836)* Added missing explanations for some parameters in glob and iglob.* News entry.* Added proper 'func' indication in News file.* Consistent use of backticks.* Improved wording.* consistent wording between the two docstrings---------(cherry picked from commit e54225545866d780b12d8e70c33d25fc13b2c3a9)Co-authored-by: Facundo Batista <facundo@taniquetil.com.ar>Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
…ob and iglob. (pythonGH-144836)* Added missing explanations for some parameters in glob and iglob.* News entry.* Added proper 'func' indication in News file.* Consistent use of backticks.* Improved wording.* consistent wording between the two docstrings---------(cherry picked from commite542255)Co-authored-by: Facundo Batista <facundo@taniquetil.com.ar>Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
GH-145415 is a backport of this pull request to the3.14 branch. |
GH-145416 is a backport of this pull request to the3.13 branch. |
Uh oh!
There was an error while loading.Please reload this page.
I took the explanations for the missing parameters from the documentation itself (slightly edited for brevity) for the cases of
root_diranddir_fdin bothglobandiglob.For the case of
iglob'sinclude_hidden, I just copied it fromglob.