[SciPy-Dev] Static Typing

Stefan van der Walt stefanv at berkeley.edu
Wed Jun 30 14:06:54 EDT 2021


On Wed, Jun 30, 2021, at 09:03, Evgeni Burovski wrote:
> ISTM it's important that annotations are optional in the sense that we
> do not explicitly require that new code is typed. If someone is
> willing to add them, great (and if someone is willing to review a
> typing PR, even better :-)). But this should be possible to do in a
> follow-up PR, not as a requirement for an enhancement PR.

I agree, especially given that the typing notation is still changing.  For example, they're currently working out a shorthand for typing function definitions (and I'm sure other simplifications are in the pipeline too).

I'd still like to find proof that typing has significant impact.  There have been some studies in JavaScript land that give rough metrics like "1/6 bugs could have been identified with typing" [0].  But then you see the Flask team annotating their entire project and finding almost none; probably because in Python we tend to test differently.  We also tend to have more functional interfaces that return straightforward built-in objects.

For now, I feel typing still mostly benefits IDE users.  Perhaps in the future we'll see the accelerated frameworks Tyler referred to using it as well.

Stéfan

[0] https://earlbarr.com/publications/typestudy.pdf


More information about the SciPy-Dev mailing list