kirancodes.me
To Proof Maintenance & Beyond!

Python probabilistic type inference with natural language support

Zhaogui Xu, Xiangyu Zhang, Lin Chen, Kexin Pei, Baowen Xu

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.

BibTeX
@inproceedings{Xu-al:FSE16,
  author    = {Zhaogui Xu and
               Xiangyu Zhang and
               Lin Chen and
               Kexin Pei and
               Baowen Xu},
  title     = {Python probabilistic type inference with natural language support},
  booktitle = {FSE},
  pages     = {607--618},
  publisher = {{ACM}},
  year      = {2016},
}

Related papers