I just discovered function annotations for python 3 (https://www.python.org/dev/peps/pep-3107/) which seems great for documenting parameters or return types. It also makes better intellisense available in my pycharm IDE.
I have a question regarding parameters where the input type is fuzzy. For example, it could be a list or numpy array or some "array-like" quantity. What is the best way to annotate such an input parameter to the function? Example:
import numpy as np
def fun(data: np.ndarray) # can also be a list
pass
I have another case where the input can be any of the two types. Example:
def fun(header: Nifti1Header) # can also be Nifti2Header
pass
What is the best way to document these kinds of parameter inputs?