A Constraint Based Bug Checking Approach for Python

Python is a powerful dynamically typed programming language. Dynamic typing brings great flexibility for programming. However, lack of static type checking, it is hard to detect some bugs before run time. We present a constraint framework based on Python’s structural equivalence type system. The framework does not introduce any new language features, thus without losing benefits of Python’s dynamic typing. Constraints are extracted from source code via static analysis and are used to check bugs, such as passing wrong parameters to function. A case study shows how to use the framework to check validity of function calls.