Re:Dynamic type systems are not inherently more open
by zitterbewegung on Sunday January 19, 2020 @09:43AM
(#22091661)
What would be neat is if you could take a Python program and run type inference on the program and it would output a type annotated version of the code.
[ Parent
| on HN ]
Re:Dynamic type systems are not inherently more open
by duckerude on Sunday January 19, 2020 @11:35AM
(#22092264)
I don't have experience with it, but pytype can do that: https://github.com/google/pytype
After typechecking it leaves provisional stubs in .pytype/pyi/, and it has a tool to merge them into the original code.
mypy has stubgen: https://mypy.readthedocs.io/en/latest/stubgen.html
As far as I know it's less powerful since mypy isn't really built for unannotated code and pytype is.