On Mon, Jun 18, 2018 at 5:45 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote:
> On Mon, 18 Jun 2018 14:57:30 +0000, Schachner, Joseph wrote: > > I believe the proposed type hints are only necessary > > for function definitions, > > What is the basis of this belief? How much experience do you have using > type annotations and gradual typing? > > On a scale of 0 to 10, where 0 is "never even used it", and 10 is "used > it extensively on projects with tens or hundreds of thousands of lines of > code", where do you fit? > I've done 10 projects of varying sizes with Python 3 type hints now. Some I wrote from scratch with type hints from the beginning, others I retrofitted type hints into existing code. I've found that I mostly add type hints to function definitions, but infrequently I have to add them to the creation of collection types, like an empty list or empty dictionary. I tend to call mypy like: mypy --disallow-untyped-call foo.py bar.py ...or: mypy --disallow-untyped-calls --ignore-missing-imports foo.py bar.py ...if there are dependency modules that don't (yet?) have type hints in them. I'm eager to try MonkeyType and/or pep484transform.py to automatically add type hints, but so far I've only added them manually. It remains to be seen (by me, at least) how many nonessential names will be type hinted by these tools. Instagram says mypy is by far the most common python type checker, but they like "pyre" for its speed, which is another type checker. -- https://mail.python.org/mailman/listinfo/python-list