Skip to content

pathlib ABCs: remove or namespace private attributes #127807

Closed

Description

@barneygale

@encukou pointed out:

I see there's currently no distinction between pathlib-internal attribute names and names that are free for third-party subclasses to use.
Should there be a stronger namespace for these, like _pathlib_sep, _pathlib_globber & _pathlib_stack?
Or should _sep & co. be documented so users know to not override them?

PurePathBase and PathBase have ~10 private attributes for facilitating copying, ~3 for matching and globbing, and ~3 more for miscellaneous purposes. We should try to eliminate as many as possible, and namespace the rest (e.g. under _pathlib_)

Linked PRs

Activity

  1. added 8 commits that reference this issue on Dec 11, 2024
  2. added 6 commits that reference this issue on Dec 22, 2024
  3. barneygale commented on Dec 22, 2024

    @barneygale
    ContributorAuthor

    This is done, with two exceptions:

    1. PathBase._scandir() will be removed as part of Expose os.DirEntry objects from pathlib #125413
    2. PathBase._delete() will be made public some time, hopefully.
  4. added 3 commits that reference this issue on Dec 23, 2024
  5. added 4 commits that reference this issue on Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-pathlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions