Re:A Failed Experiment with Python Type Annotations
by quietbritishjim on Wednesday June 12, 2019 @03:43AM
(#20162550)
Am I missing something? Annotations aren't supported by Python 2 so if you're using them then you never need to worry about Python 2/3 compatibility.
[ Parent
| on HN ]
Re:A Failed Experiment with Python Type Annotations
by joshuamorton on Wednesday June 12, 2019 @04:15AM
(#20162686)
Yes and no.
Annotations in comments or in type stubs are supported in python2 (you can look at typeshed for typing.Text and conditional py2/3 stuff). There's also some other cases, but they're...unique.
Re:A Failed Experiment with Python Type Annotations
by rcfox on Wednesday June 12, 2019 @08:29AM
(#20163831)
mypy supports comment-based annotations for Python 2. https://mypy.readthedocs.io/en/latest/python2.html