-
Notifications
You must be signed in to change notification settings - Fork 258
Type interference: ProtocolOf
?
#1944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Idea of
|
(I am not a member here, so this is only my personal opinion) This is lovely idea, I've written a similar idea recently, but as expected I was not the first to come up with an idea on this, for example you will find discussions and further links here for example:
However,
Decide if you want to start a new discussion, or bring new input/support to the existing ones. And, hopefully we will get a concrete draft of a PEP on this to add this to the typing-specs. When more points are fledged out we can think of runtime implementations and how type-checkers have to support this. |
I'm looking the way to interfere existing types explicitly, like
typeof
/keyof
inTypescript
I have 2 use cases:
Callable[...]
__init__
signature / protocolI think it should look like:
Should be equal to:
Or dataclasses:
Here I'm not sure which way is better
Should be equal to:
Should be equal to:
Callable
/Protocol
toParamSpec
/Returning
to use in typingI see typing.get_args but it doesn't looks suitable for typing. Also
Instead of that it should be way to define
FooParamSpec
/FooReturning
Bonus
there are no way to convert TypedDict to ParamSpec.kwargs
UPD: is't bound to typing.Unpack
The text was updated successfully, but these errors were encountered: