Do you want “any type” or do you want “any type with these characteristics”?
bound support Protocol?
T = TypeVar("T") class TypeClassEq(Protocol[T]): def __eq__(self: T, other: T) -> bool: ... TEq = TypeVar("TEq", bound=TypeClassEq)
If so, then
bound could be used to mimic constraints by type-classes.
retry_asyncand the related inner functions of the wrap
async deffor both
tmp.py:29: error: Incompatible return value type (got "Callable[[Callable[..., Awaitable[Any]]], Callable[..., Awaitable[Any]]]", expected "Callable[..., Awaitable[Any]]")with this gist https://gist.github.com/Callek/8bca70ffbe560c22dba72b21ecd49ec8
@gaborbernat is it worth re-opening again?
Got very late the notification for this. I think the feature would be very useful in a post no python 2 world too. It's a matter of fact that type annotations make the code more verbose; so there will be projects who don't want to pay the price of this, or projects you can't modify. In this case, you want to provide the type information as stubs... and for maintaining those stubs would be great if you can use some merge-check tool to validate they're correct against the source.