On Mon, Nov 6, 2017 at 11:34 AM, Stéfane Fermigier <sf@fermigier.com> wrote:
[...]
 
Now I believe something could be done along the lines:

a) record runtime type information from test or regular runs
b) massage these information and use them to annotate Python code with additional type information (up to the developer to then accept or not the proposed changes)
c) also run a test suite or an app under some magical machinery, and either raise a TypeError or log warnings when discrepancies are detected between type annotation and runtime behaviour.

[...] (a) and (b) would use similar machinery,

I mean, (a) and (c)
 
and (a), (b) and (c) would be probably a useful way to introduce type annotations to an existing code base without too much risk.

(a) and (b) could also provide data for an interesting SE research project.

Similar to "Measuring Polymorphism in Python Programs", by Beatrice Akerblom and Tobias Wrigstad: 
https://people.dsv.su.se/~beatrice/python/dls15_large_images.pdf

  S.

--
Stefane Fermigier - http://fermigier.com/ - http://twitter.com/sfermigier - http://linkedin.com/in/sfermigier
Founder & CEO, Abilian - Enterprise Social Software - http://www.abilian.com/
Chairman, Free&OSS Group / Systematic Cluster - http://www.gt-logiciel-libre.org/
Co-Chairman, National Council for Free & Open Source Software (CNLL) - http://cnll.fr/
Founder & Organiser, PyData Paris - http://pydata.fr/
---
“You never change things by fighting the existing reality. To change something, build a new model that makes the existing model obsolete.” — R. Buckminster Fuller