[SciPy-Dev] Static Typing
Ralf Gommers
ralf.gommers at gmail.com
Wed Jun 30 14:14:55 EDT 2021
On Wed, Jun 30, 2021 at 8:07 PM Stefan van der Walt <stefanv at berkeley.edu>
wrote:
> 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).
>
That is the current state, and I agree it should stay like that.
> I'd still like to find proof that typing has significant impact.
Consider this: having type annotations + mypy would have prevented writing
np.matrix, and we would have sane ndarray subclassing. I think that's the
main impact. Finding bugs it doesn't help much with (and the ones it does
catch are usually easy ones).
Cheers,
Ralf
> 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
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at python.org
> https://mail.python.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/scipy-dev/attachments/20210630/a3c556c9/attachment.html>
More information about the SciPy-Dev
mailing list