[code-quality] Python skeletons: type hinting for third-party libraries
Florian Weimer
fweimer at redhat.com
Fri Nov 8 12:15:11 CET 2013
On 11/08/2013 11:19 AM, Vladimir Keleshev wrote:
> I agree that not writing any type annotations is the best, but that would require complex type inference. OCaml does type inference for it's duck-typed objective extension, but I'm not sure that such type inference is possible for a dynamic language like Python.
The skeleton files wouldn't contain an actual Python implementation,
only a rough summary from which requirements can be extracted.
Especially conditional code should be kept to a bare minimum. Type
inference (which would reconstruct some principal type of the function,
needing a suitable type system that can express such type) is not
required for the skeleton, you can use the same type propagation engine
you use for extracting information in client code which you can then
check against the skeleton.
--
Florian Weimer / Red Hat Product Security Team
More information about the code-quality
mailing list