FWIW, I noted that mypy is much better when run in --strict mode. Otherwise, mypy will ignore some clear errors.
Also, there are some tools that can automate creating mypy annotations: https://mypy.readthedocs.io/en/stable/existing_code.html#automate-annotation-of-legacy-code On Fri, Jul 30, 2021 at 2:51 PM Edward K. Ream <[email protected]> wrote: > An update. > > > Imo, static type checking adds little to python. If you want proper type > checking, try rust or other typed languages. > > That's a hasty verdict. mypy runs off of annotations, so it's unfair to > expect mypy to be much help without them! > > The annotations of the types returned from functions and methods are > likely to be the most important. Such annotations cut the Gordian knot of > type inferences. Local inferences are straightforward; inferring return > types is much harder. > > > Impatience is the clear enemy here. The work is mundane, but I must not > introduce any new bugs! > > Yesterday I completed the annotations for leoGlobals.py so that mypy now > passes launchLeo.py. > > The work was indeed tedious. Afterward, I thought that a wax-on script, > the companion of wax-off, would have saved me much of the tedium. But wait. > Adding annotations for returned types is much harder than adding > annotations for arguments, and wax-on would not help. > > Oh my. As I write this, I think I remember that my old make_stub_files ( > *msb*) project calculates returned types based on pattern matches of the > values of all "return" statements. *Aha!* Time to experiment with msb! > > *Summary* > > Aha! My old make_stub_files project may be more valuable than I > remembered. I'll delay writing the wax-on script. > > My focus for Leo 6.4 is to complete Leo's mypy command. I'll also > carefully fix any bugs that mypy reveals. > > Except for leoGlobals.pyi, I will create no new stub files for Leo 6.4. I > will *not* add annotations to Leo's source files themselves. > > Edward > > -- > You received this message because you are subscribed to the Google Groups > "leo-editor" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/leo-editor/20c35a7e-d6e1-40c5-ba8c-84561d1969d1n%40googlegroups.com > <https://groups.google.com/d/msgid/leo-editor/20c35a7e-d6e1-40c5-ba8c-84561d1969d1n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/CAPuzRuOSHoCt%2BRe9oNgTyYdFUa-KfwE8pvZfVXSjG9EecwmKUQ%40mail.gmail.com.
