Let's say we have a function
Python is a dynamically typed language, so no; a function should document their expectations instead.
Python 3.5 and newer support optional type hinting; if the library uses type hints, then you can query this information with the
typing.get_type_hints() function to access that information programatically.
Generally, Python functions should accept objects that implement expected functionality, not specific types. If your function iterates over a sequence to extract strings, then it should be documented as accepting (in type hinting terms) a
Iterable[str] object, not a list or tuple or other specific type.