Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-144835: Added missing explanations for some parameters in glob and iglob.#144836

Merged
facundobatista merged 9 commits intopython:mainfrom
facundobatista:improve-globglob-docstrings
Mar 2, 2026
Merged

gh-144835: Added missing explanations for some parameters in glob and iglob.#144836
facundobatista merged 9 commits intopython:mainfrom
facundobatista:improve-globglob-docstrings

Conversation

@facundobatista
Copy link
Member

@facundobatistafacundobatista commentedFeb 15, 2026
edited by bedevere-appbot
Loading

I took the explanations for the missing parameters from the documentation itself (slightly edited for brevity) for the cases ofroot_dir anddir_fd in bothglob andiglob.

For the case ofiglob'sinclude_hidden, I just copied it fromglob.

Lib/glob.py Outdated
Comment on lines +28 to +34
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
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.

Copy link
Member

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

Copy link
Member

@terryjreedyterryjreedy left a 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.

@bedevere-app
Copy link

When you're done making the requested changes, leave the comment:I have made the requested changes; please review again.

@terryjreedyterryjreedy added needs backport to 3.13bugs and security fixes needs backport to 3.14bugs and security fixes labelsFeb 15, 2026
@facundobatista
Copy link
MemberAuthor

@hugovk@terryjreedy I have made the requested changes; please review again, thanks!!

@bedevere-app
Copy link

Thanks for making the requested changes!

@terryjreedy: please review the changes made to this pull request.

@facundobatista
Copy link
MemberAuthor

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

@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?

    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 (without actually     changing it). If pathname is relative, the result will contain     paths relative to `root_dir`.

Thanks!

gpshead reacted with thumbs up emoji

@facundobatista
Copy link
MemberAuthor

@hugovk@terryjreedy@gpshead hey! let me know please if you need something else is needed before I go forward with merging this. Thanks!

@facundobatista
Copy link
MemberAuthor

@gpshead thanks!

@facundobatistafacundobatista merged commite542255 intopython:mainMar 2, 2026
50 of 51 checks passed
@miss-islington-app
Copy link

Thanks@facundobatista for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMar 2, 2026
…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>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMar 2, 2026
…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>
@bedevere-app
Copy link

GH-145415 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelMar 2, 2026
@bedevere-app
Copy link

GH-145416 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelMar 2, 2026
hugovk pushed a commit that referenced this pull requestMar 2, 2026
…lob and iglob. (GH-144836) (#145415)Co-authored-by: Facundo Batista <facundo@taniquetil.com.ar>Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
hugovk pushed a commit that referenced this pull requestMar 2, 2026
…lob and iglob. (GH-144836) (#145416)Co-authored-by: Facundo Batista <facundo@taniquetil.com.ar>Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@hugovkhugovkhugovk left review comments

@gpsheadgpsheadgpshead approved these changes

@terryjreedyterryjreedyAwaiting requested review from terryjreedy

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@facundobatista@gpshead@hugovk@terryjreedy

[8]ページ先頭

©2009-2026 Movatter.jp