Currently Python allows you to define functions like
def f(x, A):
I would like to be able to define functions like
def f(x: int, A: list):
because I think it would cut down on programmer errors.
How can I do this?
Right now I am resorting to
def f(x, A):
assert type(x) == int and type(A) == list, "Invalid parameters to function f"
But I think it might be easier if I could just change the signature of the def
function.