[SciPy-Dev] Static Typing
josef.pktd at gmail.com
josef.pktd at gmail.com
Wed Jun 30 14:27:41 EDT 2021
On Wed, Jun 30, 2021 at 2:15 PM Ralf Gommers <ralf.gommers at gmail.com> wrote:
>
>
> 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).
>
I don't think it would have prevented np.matrix. The demand for that was
too high.
(For statsmodels) I worry more that it limits flexibility or gets too
complicated.
e.g. "instance with interface like scipy.distributions but only cdf and ppf
need to be available"
Josef
>
> 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
>>
> _______________________________________________
> 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/69399aad/attachment-0001.html>
More information about the SciPy-Dev
mailing list