Эссе о разработке игр, мышлении и книгах

Python 3 Types in the Wild

Вышла статья с исследованием состояния статической типизации в Python. Я её наискосок просмотрел, всё примерно так, как я и рассказывал в эссе:

Далее несколько интересных цитат.

false positivestrue positives
likely runtime
errors
true positives
incorrect
annotations
MyPy52 (49%)29 (28%)24 (23%)
PyType34 (44%)32 (42%)11 (14%)

Summary of hand-examined error reports.

Surprisingly, when developers use static types, the code rarely type-checks with either of the tools.

The results of the comparison support our argument from Sect. 2 that MyPy and PyType are essentially two different type systems.

The picture is mixed. On the one hand, types can already help catch many bugs, such as in the use of Optional types that may be None and in function return type annotations. On the other hand, type checking tools frequently disagree with user annotations and with each other. Most open-source projects do not yet use Python 3 types, and of those that do, few type-check.