I have a function that takes a callback
function as a parameter:
def function(arg1: int, callback):
...
I am trying to add a type hint for the callback
function. Now, the callback functions that are passed to this function have the same positional args but the kwargs can be completely different (both in type and name).
def function1(arg1: int, arg2: str, **kwargs1):
...
def function2(arg1: int, arg2: str, **kwargs2):
...
I am trying to write a Callback Protocol that fits these 2 functions, but so far I don't see a way to make this work when the kwargs are different. Is there a way to create a unified Callback protocol in this case?
from Callback protocol for functions with different kwargs
No comments:
Post a Comment