Python Probabilistic Type Inference with Natural Language Support

Zhaogui Xu,Xiangyu Zhang,Lin Chen,Kexin Pei,Baowen Xu
DOI: https://doi.org/10.1145/2950290.2950343
2016-01-01
Abstract:We propose a novel type inference technique for Python programs. Type inference is difficult for Python programs due to their heavy dependence on external APIs and the dynamic language features. We observe that Python source code often contains a lot of type hints such as attribute accesses and variable names. However, such type hints are not reliable. We hence propose to use probabilistic inference to allow the beliefs of individual type hints to be propagated, aggregated, and eventually converge on probabilities of variable types. Our results show that our technique substantially outperforms a state-of-the-art Python type inference engine based on abstract interpretation.
What problem does this paper attempt to address?