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

Exposeos.DirEntry objects from pathlib #125413

Closed
Labels
performancePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directorytopic-pathlibtype-featureA feature request or enhancement
@barneygale

Description

@barneygale

Feature or enhancement

I propose we add a newPath.status attribute that stores anos.DirEntry object in paths yielded fromPath.iterdir(), or a pathlib-specific type with a similar interface in other paths.

This would:

  • Allow users to access to the cachedos.DirEntry after callingPath.iterdir(), which is useful for efficiently determining files' types and often doesn't involve a system call.
  • Allow users to switch on the type ofany path without repeatedly making system calls, or having to resort toS_ISREG(st.st_mode) and other holy incantations.
  • In the pathlib ABCs, allows us to entirely banishPathBase.stat() and thestat_result interface, which is too low-level and local filesystem-specific

See discussion:https://discuss.python.org/t/is-there-a-pathlib-equivalent-of-os-scandir/46626

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directorytopic-pathlibtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp