According to PEP484 one can declare type hints using a "comments" format.
It would be good that create_function supports this way of defining the type hints:
func_signature = """
foo(b, # type: int
a = 0, # type: float
):
# type: (...) -> str
"""
def dummy_handler(*args, **kwargs):
return "hello"
dynamic_fun = create_function(func_signature, dummy_handler)
assert dynamic_fun.__annotations__ == {'a': float, 'b': int, 'return': str}
According to PEP484 one can declare type hints using a "comments" format.
It would be good that
create_functionsupports this way of defining the type hints: