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

Speed uppathlib.Path.iterdir() by usingos.scandir() #117727

Closed
@barneygale

Description

@barneygale

We should be able to callos.scandir() frompathlib.Path.iterdir() and construct results based on theos.DirEntry.path string.

Currently we callos.listdir() and_make_child_relpath(), which returns a fully parsed/normalized string; particularly, it sets_str,_drv,_root and_tail_cached.

It's probably not worth the expense of setting_drv,_root and_tail_cached - they're only useful when paths are subsequently deconstructed withPurePath methods, which isn't particularly common. Itis worth setting_str, and happilyos.DirEntry.path provides a string that's very nearly normalized to pathlib's standards.

Also discussed here:https://discuss.python.org/t/is-there-a-pathlib-equivalent-of-os-scandir/46626/21

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