The fact that python 3.5+ supports type hints has a great use case when generating wrappers, for instance through SWIG.
Having type hints when working with a large C++ API would make for a much improved experience, since your IDE / linter can perform compile time type checking.
How does one generate type hints with SWIG?
The swig autodoc feature, can give you this, at least in simple cases.
Adding %feature("autodoc", "1")
to your SWIG interface code, will generate things like:
def function_name(*args, **kwargs):
"""function_name(int x, int y, Foo foo=None, Bar bar=None) -> bool"""
...
See http://www.swig.org/Doc3.0/SWIGDocumentation.html#Python_nn67
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With