I hereby claim:
- I am alanbato on github.
- I am alanbato (https://keybase.io/alanbato) on keybase.
- I have a public key whose fingerprint is E1E6 D2FF 5759 6F34 6259 F195 3EE1 D8A2 85CE 4D6D
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
def typecheck(func): | |
def wrapper(*args, **kwargs): | |
for argname, argvalue in zip(func.__code__.co_varnames, | |
args): | |
annotated_type = func.__annotations__[argname] | |
real_type = type(argvalue) | |
if not issubclass(real_type, annotated_type): | |
raise TypeError(f'expected:{annotated_type}\n' | |
f'got: {real_type}\n' | |
f'for argument {argname}') |