Create a Python function decorator to check the type of a function argument.
Anonymous
def check_type(typ): def check(func): def wrapper(arg): assert isinstance(arg, typ) return func(arg) return wrapper return check
Check out your Company Bowl for anonymous work chats.