You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#83066 considered making os.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:
add it to typing._PROTO_ALLOWLIST so it can be used as a base class in other protocols
use class PathLike(metaclass=abc.ABCMeta) instead of class PathLike(abc.ABC). This aligns with the other protocol-like ABCs in collections.abc. Actual protocols do have that metaclass but don't have the abc.ABC base class. Doing this makes it a little smoother for typeshed to define the class as class PathLike(Protocol) in the stubs.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Feature or enhancement
Proposal:
#83066 considered making
os.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:
class 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
The text was updated successfully, but these errors were encountered: