Closed
Description
This was already partly discussed in #9. I think we should start adding some commonly used protocols, type aliases, and other features from _typeshed
to typing_extensions so they are available at runtime. This would prevent awkward guarded imports at runtime.
I would suggest to put this into a submodule to separate those types from the "backports and experimental features" that are added to the main namespace. Suggestion: typing_extensions.ext
. For a start I would suggest to add the following:
- Some simple dunder protocols:
SupportsNext
,SupportsAnext
,SupportsTrunc
,SupportsDivMod
,SupportsRDivMod
. (I would hold off on protocols likeSupportsAdd
for now as they are usingAny
.) SupportsGetItem
,SupportsItems
andSupportsKeysAndGetItem
- The path aliases
StrPath
,BytesPath
.StrOrBytesPath
probably doesn't have much value overStrPath | BytesPath
. - Some simple I/O protocols:
SupportsRead
,SupportsReadline
,SupportsWrite