Replies: 1 comment
-
For anyone interested, It seems that i solved this problem by removing the type param from the class and instead bind it with the register method. see details here: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello guys, recently I have been struggling with type hinting decorators, and would really appreaciate some help.
I'll start with the code to better illustrate the issue here.
The goal: make the
register
method accepts any callable that receives E and subclasses of E(covariant).The problem:
the register method is a decorator, receiving the function and return it. but using a same generic type param in both function input and output would result it being invariance, meaning that decorated function should have the exact same type with the type param T.
Beta Was this translation helpful? Give feedback.
All reactions