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

Optimizepathlib.Path.iterdir() and friends by usingos.DirEntry.path #113225

Closed
@barneygale

Description

@barneygale

pathlib.Path.glob() callsos.scandir() under the hood, convertingos.DirEntry objects to path objects using a private_make_child_relpath() method. This builds a child path from a given basename. The basename is obtained from the dir entry'sname attribute.

I've just spotted (or realised) that dir entries have apath attribute that we could use, rather than constructing our own string path from the basename. This seems to be a fair bit faster in my testing.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp