iotile / typedargs

API typechecking and command line shell generation package
GNU Lesser General Public License v3.0
1 stars 2 forks source link

Support recursive function annotations #62

Closed timburke closed 4 years ago

timburke commented 4 years ago

We already have a concept of complex types that are composed of simpler types in typedargs. Python 3 function annotations have a similar concept as well that lets you declare a return type of, for example, Dict[str, int].

As part of supporting function annotations as a valid way of declaring types to typedargs, we should map a complex type like Dict[str, int] to our internal complex type of dict(str, int) which is how we could have specified it in a docstring or legacy @param decorator.

This should work for both function parameters and return values.