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

Make os.Pathlike more similar to a Protocol #126705

Closed
Labels
@tungol

Description

@tungol

Feature or enhancement

Proposal:

#83066 considered makingos.Pathlike a protocol, but rejected the idea due to not wanting to import typing into os.py.

As an alternative, I propose making more it more protocol-like in two ways:

  1. add it to typing._PROTO_ALLOWLIST so it can be used as a base class in other protocols
  2. useclass PathLike(metaclass=abc.ABCMeta) instead ofclass PathLike(abc.ABC). This aligns with the other protocol-like ABCs incollections.abc. Actual protocols do have that metaclass but don't have theabc.ABC base class. Doing this makes it a little smoother for typeshed to define the class asclass PathLike(Protocol) in the stubs.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp