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

Deprecate glob.glob0() and glob.glob1() #117337

Closed
Labels
3.13bugs and security fixes
@serhiy-storchaka

Description

@serhiy-storchaka

Undocumented functionsglob0() andglob1() were just helpers forglob.iglob(). They are not underscored because theglob module has__all__. They survived numerous refactorings only because they were used in themsilib module and some MSI related scripts. But themsilib module and these scripts have been removed.

glob1(root_dir, pattern) is equivalent toiglob1(os.path.join(glob.escape(root_dir), pattern)), but more restricted and slightly faster, because it does not need to escaperoot_dir and process the result.

Other alternative isiglob(pattern, root_dir=root_dir), which can even be faster, but it emits paths relative toroot_dir. You can use(os.path.join(root_dir, p) for p in iglob(pattern, root_dir=root_dir)) if you need to appendroot_dir. Actually, creating an efficient replacement ofglob1() was one of purposes ofroot_dir.

glob0(root_dir, name) just checks thatos.path.join(root_dir, name) exists. I did not see its use in third-party code.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp