I want to allow type hinting using Python 3 to accept instances which are children of a given class. I'm using the enforce module to check the function typing. E.g.:
import abc
class A(metaclass=abc.ABCMeta)
pass
class B(A)
def __init__(self,a)
self.a = a
pass
x = B(3)
@enforce.runtime_validation
def function(x:A)
print(x.a)
but it seems like python 3 doesn't allow for this syntax, returning:
Argument 'x' was not of type < class 'A' >. Actual type was B.
Any help?