osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] 2to3 for python annotations


On Tue, Jul 17, 2018 at 1:17 PM, Jelle Zijlstra <jelle.zijlstra at gmail.com>
wrote:

>
>
> 2018-07-17 12:37 GMT-07:00 Philippe Fremy <phil.fremy at free.fr>:
>
>> Hi,
>>
>> While contributing to pyannotate, I became familiar enough with 2to3
>> fixers to be able to convert Python 2 style annotations to Python 3.
>>
>> Is it something that would be interesting to put into python 2to3 ? If
>> so I would propose a PR for this.
>>
>> There already a tool that does this: https://github.com/
> ilevkivskyi/com2ann.
>

IIRC that tool so far only converts variable declarations with `# type:`
comments to PEP 526 style. Doing function signatures too seems on the TODO
list:
https://github.com/ilevkivskyi/com2ann/issues/3


> I am not sure it would be appropriate for 2to3. Type comments still work
> in Python 3, and I feel like 2to3 should do the minimum necessary to get
> working code in Python 3.
>

I think as an optional fixer it would be a fine contribution.

Also I apologize for not yet reviewing
https://github.com/dropbox/pyannotate/pull/74 (which I presume is yours?).

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180717/cdded7ad/attachment.html>