In order to define functions' input and output parameters, they must be properly defined in Python.
Input parameters can be defined using default values. Output type can not be defined.
@register
def add(a=0, b=0):
return a + b
Input and output parameters can be defined in docstring:
@register
def add(a, b):
"""
(int, int) -> int
"""
return a + b
Input and output parameters can be defined in 'register' decorator:
@register(int, int, int) # a, b, return
def add(a, b):
return a + b
For future Python 3 compatibility, function annotations may be used:
@register
def add(a: int, b: int) -> int:
return a + b