[Python-ideas] Possible enhancement to typing
sf at fermigier.com
Wed Nov 8 03:09:37 EST 2017
On Tue, Nov 7, 2017 at 9:27 PM, Guido van Rossum <guido at python.org> wrote:
> On Mon, Nov 6, 2017 at 10:36 PM, Stéfane Fermigier <sf at fermigier.com>
>> On Tue, Nov 7, 2017 at 2:58 AM, Guido van Rossum <guido at python.org>
>>> On Mon, Nov 6, 2017 at 2:34 AM, Stéfane Fermigier <sf at fermigier.com>
>>>> 4) 10 years ago, when I was working on the EDOS project (
>>>> s-project-story_en.pdf ), 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
>>>> 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.
>>> I didn't know this. Do you know where there are docs for this feature?
>> This was described in this blog post when first introduced:
>> And more tersely, in the documentation: https://www.jet
> Oh. It sounds like it doesn't generate stubs or PEP 484 annotations.
The blog post was written in 2013, PEP 484 was not yet adopted at the time,
and so they targeted their own typechecker and typing annotation
conventions, which were at the time based on docstrings conventions.
I have just checked with the current PyCharm version, and when using the
"add annotation" intention, they're using now either the "# type: (...) ->
...", or the PEP484 conventions, depending on the version of Python you're
using for your particular workspace.
Also, I found the the call signature collection mechanism during debug run
seems to live in the PyDev.Debugger project (
https://github.com/fabioz/PyDev.Debugger/ which is common to PyDev and
PyCharm), more specifically here:
Stefane Fermigier - http://fermigier.com/ - http://twitter.com/sfermigier -
Founder & CEO, Abilian - Enterprise Social Software -
Chairman, Free&OSS Group / Systematic Cluster -
Co-Chairman, National Council for Free & Open Source Software (CNLL) -
Founder & Organiser, PyData Paris - http://pydata.fr/
“You never change things by ﬁghting the existing reality. To change
something, build a new model that makes the existing model obsolete.” — R.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas