You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ok, I really thought that this is a good idea. But, now it seems to me that I was wrong.
Why?
First of all, it is very limited. For example, you cannot write def a(instance: Union[str, bytes]). We can only work with Instance types because of the limited runtime-dispatch capabilities
It makes our code much more complex. And I mean it! With this feature we now have to typecheck a whole other set of cases. Let's see some examples:
defex():
...
some.instance(ex) # will typecheck, because we allow callables, but should not.# So, we need a plugin support for this - and it is really complex, because it has lots of corner cases
It makes our code much less type-safe. There are cases when Callable should not be allowed into first .instance() call
Runtime algorithm is not perfect as well, it is now focused on getattr(arg, '__annotations__') and the thing is arg might have __annotations__ even if it is not a function. So, I need to figure out another solution. But, probably the best way to solve this is to remove this feature
So, I have decided to remove this. Yes, it is a breaking changed, but there are just several users, and upgrade is really easy.
Ok, I really thought that this is a good idea. But, now it seems to me that I was wrong.
Why?
def a(instance: Union[str, bytes])
. We can only work withInstance
types because of the limited runtime-dispatch capabilitiesCallable
should not be allowed into first.instance()
callgetattr(arg, '__annotations__')
and the thing isarg
might have__annotations__
even if it is not a function. So, I need to figure out another solution. But, probably the best way to solve this is to remove this featureSo, I have decided to remove this. Yes, it is a breaking changed, but there are just several users, and upgrade is really easy.
Reverts #136
The text was updated successfully, but these errors were encountered: