<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 10.09.2015 06:12, Jukka Lehtosalo wrote:<br>
    <blockquote
cite="mid:CAA_f+LyMKuJLHobK_of+Pt2Qpd5AhvvX839RekRfFdv35TJ-tg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">This has been discussed almost to the
            death before, <br>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    I am sorry. :)<br>
    <br>
    <blockquote
cite="mid:CAA_f+LyMKuJLHobK_of+Pt2Qpd5AhvvX839RekRfFdv35TJ-tg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div>but there are some of main the benefits as I see them:</div>
            <div>- Code becomes more readable. This is especially true
              for code that doesn't have very detailed docstrings.</div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    If I have code without docstrings, I better write docstrings then.
    ;)<br>
    <br>
    I mean when I am really going to touch that file to improve
    documentation (which annotations are a piece of), I am going to add
    more information for the reader of my API and that mostly will be
    describing the behavior of the API.<br>
    <br>
    If my variables have crappy names, so I need to add type hints to
    them, well, then, I rather fix them first.<br>
    <br>
    <blockquote
cite="mid:CAA_f+LyMKuJLHobK_of+Pt2Qpd5AhvvX839RekRfFdv35TJ-tg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div>This may go against the intuition of some people, but
              my experience strongly suggests this, and many others
              who've used optional typing have shared the sentiment. It
              probably takes a couple of days before you get used to the
              type annotations, after which they likely won't distract
              you any more but will actually improve code understanding
              by providing important contextual information that is
              often difficult to infer otherwise.</div>
            <div>- Tools can automatically find most (simple) bugs of
              certain common kinds in statically typed code. A lot of
              production code has way below 100% test coverage, so this
              can save many manual testing iterations and help avoid
              breaking stuff in production due to stupid mistakes (that
              humans are bad at spotting).</div>
            <div>- Refactoring becomes way less scary, especially if you
              don't have close to 100% test coverage. A type checker can
              find many mistakes that are commonly introduced when
              refactoring code.</div>
            <div><br>
            </div>
            <div>You'll get the biggest benefits if you are working on a
              large code base mostly written by other people with
              limited test coverage and little comments or
              documentation.</div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    If I had large untested and undocumented code base (well I actually
    have), then static type checking would be ONE tool to find out
    issues.<br>
    <br>
    Once found out, I write tests as hell. Tests, tests, tests. I would
    not add type annotations. I need tested functionality not proper
    typing.<br>
    <br>
    <blockquote
cite="mid:CAA_f+LyMKuJLHobK_of+Pt2Qpd5AhvvX839RekRfFdv35TJ-tg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div>You get extra credit if your tests are slow to run and
              flaky,</div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    We are problem solvers. So, I would tell my team: "make them faster
    and more reliable".<br>
    <br>
    <blockquote
cite="mid:CAA_f+LyMKuJLHobK_of+Pt2Qpd5AhvvX839RekRfFdv35TJ-tg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">I consider that difference pretty
            significant. I wouldn't want to increase the fraction of
            unchecked parts of my annotated code by a factor of 8, and I
            want to have control over which parts can be type checked.</div>
        </div>
      </div>
    </blockquote>
    <br>
    Granted. But you still don't know if your code runs correctly. You
    are better off with tests. And I agree type checking is 1 test to
    perform (out of 10K).<br>
    <br>
    But:<br>
    <br>
    <blockquote
cite="mid:CAA_f+LyMKuJLHobK_of+Pt2Qpd5AhvvX839RekRfFdv35TJ-tg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000"> <br>
                I don't see the effort for adding type hints AND the
                effort for further parsing (by human eyes) justified by
                partially better IDE support and 1 single additional
                test within test suites of about 10,000s of tests.<br>
                <br>
                Especially, when considering that correct types don't
                prove functionality in any case. But tested
                functionality in some way proves correct typing.<br>
              </div>
            </blockquote>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    I didn't see you respond to that. But you probably know that. :)<br>
    <br>
    Thanks for responding anyway. It is helpful to see your intentions,
    though I don't agree with it 100%.<br>
    <br>
    Moreover, I think it is about time to talk about this. If it were
    not you, somebody else would finally have added type hints to
    Python. Keep up the good work. +1<br>
    <br>
    Best,<br>
    Sven<br>
  </body>
</html>