<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Nov 6, 2017 at 2:34 AM, Stéfane Fermigier <span dir="ltr"><<a href="mailto:sf@fermigier.com" target="_blank">sf@fermigier.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>4) 10 years ago, when I was working on the EDOS project ( <a href="http://cordis.europa.eu/pub/ist/docs/directorate_d/st-ds/edos-project-story_en.pdf" target="_blank">http://cordis.europa.eu/pub/<wbr>ist/docs/directorate_d/st-ds/<wbr>edos-project-story_en.pdf</a> ), I ran a small experiment where I used, IIRC, the profile hook to intercept all function / method calls, and log information about arguments and return value types to a gigantic log file. Then the log file could be parsed and these information used to suggest type annotations. Except there were no type annotations at the time in Python.</div><div><br></div><div>I know PyCharm can do a similar thing now: you run your program or your tests under the debugger, it logs runtime type information somewhere, and then can use it to suggest autocompletion or maybe type annotations.</div></div></blockquote><div><br></div><div>I didn't know this. Do you know where there are docs for this feature?<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Now I believe something could be done along the lines:</div><div><br></div><div>a) record runtime type information from test or regular runs<br></div><div>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)</div></div></blockquote><div><br></div><div>We have an early version of a tool that does this at Dropbox; I am planning to open-source it by the end of this year. So far the experience is that the annotations require a fair amount of manual cleanup though.</div><div><br></div><div>[snip]<br></div><div> </div><div>> Similar to "Measuring Polymorphism in Python Programs", by Beatrice Akerblom and Tobias Wrigstad: <div><a href="https://people.dsv.su.se/~beatrice/python/dls15_large_images.pdf" target="_blank">> https://people.dsv.su.se/~<wbr>beatrice/python/dls15_large_<wbr>images.pdf</a></div><div><a href="https://people.dsv.su.se/~beatrice/python/dls15_large_images.pdf" target="_blank"><br></a></div></div></div>Thanks for the link!<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div></div>