def overloaded_function(*args, **kwargs): for func in typed_functions: # TODO: more intelligent overload resolution arg_spec = getattr(func, '_arguments', None) if not arg_spec: continue # TODO: encapsulate this mechanism inside EPD class expects_decorator = ExpectedParametersDecorator() expects_decorator.arg_spec = arg_spec expects_decorator.omit_self = getattr(func, '_has_self', False) try: expects_decorator._validate_arguments(args, kwargs) except ArgumentError: continue return func(*args, **kwargs)