Python Type Hints are Turing Complete
Programming Languages
2022-09-01 v1
Abstract
Grigore showed that Java generics are Turing complete by describing a reduction from Turing machines to Java subtyping. We apply Grigore's algorithm to Python type hints and deduce that they are Turing complete. In addition, we present an alternative reduction in which the Turing machines are simulated in real time, resulting in significantly lower compilation times. Our work is accompanied by a Python implementation of both reductions that compiles Turing machines into Python subtyping machines.
Cite
@article{arxiv.2208.14755,
title = {Python Type Hints are Turing Complete},
author = {Ori Roth},
journal= {arXiv preprint arXiv:2208.14755},
year = {2022}
}