Type checking tools for Python 2?

Skip Montanaro skip.montanaro at gmail.com
Tue Apr 21 21:11:00 CEST 2015

On Tue, Apr 21, 2015 at 1:29 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> I believe mypy can typecheck 2.x code in conjunction with stub files.

Thanks. Maybe the MyPy FAQ is just out-of-date? It includes this Q&A:

    All of my code is still in Python 2. What are my options?

    Mypy currently supports Python 3 syntax. Python 2 support is still
    in early stages of development. However, Python 2 support will be
    improving. Mypy includes a custom codec that lets you use Python 3
    function annotations in Python 2 code. The codec just removes the
    annotations before bytecode compilation.

Unless I misread the first couple sentences of the answer, it seems
that it can't actually grok Python 2 code. I'm not sure what to make
of the statement about a "custom codec" and how that would relate to
function annotations.


More information about the Python-list mailing list