Generating type annotations by tracing execution runs

Chris Angelico rosuav at gmail.com
Mon Jul 20 13:18:01 EDT 2015


On Mon, Jul 20, 2015 at 7:59 PM, Michael Williamson <mike at zwobble.org> wrote:
> I've knocked together a quick proof-of-concept that allows type
> annotations to be automatically added to Python source code by running
> it:
>
>     https://github.com/mwilliamson/farthing
>
> As the code, such as a test suite, runs, the types of arguments and
> return values (for functions in the file/directory to be annotated) are
> stored. After the code has finished, appropriate annotations are added.
> (There's a tiny example in the README.rst in case that makes things a
> little clearer.)

Sounds to me like a type inference system. Can be pretty handy in some
codebases.

ChrisA



More information about the Python-list mailing list