Open trim21 opened 2 months ago
Thanks @trim21 for your hard work here. I haven't tested how well type Mypyc and Cython leverage type hints. If it could indeed lead to faster execution, it would be a very compelling reason to add inline typing to the codebase.
However, I'm still in favor of maintaining support for Python 3.5. Even though it reached "End-of-life" status, these versions are still in-use and I'd like to continue releasing bug fixes and enhancements for them.
Is this a major obstacle to adding type hints, despite the existence of backporting libraries like typing_extensions
?
Is this a major obstacle to adding type hints, despite the existence of backporting libraries like
typing_extensions
?
Normally I wouldn't recommand to drop old python support for typing because we already have typing_extensions, but py35 and py36 are special.
Inline type annotation are new syntax, not new stdlib function/variable can be backported by library.
Mypyc and Cython
they doesn't work will without typing message....
Inline type annotation are new syntax, not new stdlib function/variable can be backported by library.
It the "inline type annotation" you're referring to that of PEP 484? Except if I'm missing something, it is compatible with Python 3.5
The following code is valid syntax:
def foo(a: int, b: int) -> int:
d: int = 4
return a + b + d
print(foo(3, 2))
Inline type annotation are new syntax, not new stdlib function/variable can be backported by library.
It the "inline type annotation" you're referring to that of PEP 484? Except if I'm missing something, it is compatible with Python 3.5
The following code is valid syntax:
def foo(a: int, b: int) -> int: d: int = 4 return a + b + d print(foo(3, 2))
~/.pyenv/versions/3.5.10/bin/python a.py
File "a.py", line 2
d: int = 4
^
SyntaxError: invalid syntax
I think it need at least py36
Apologies. I used an online interpreter that claims to be on version 3.5.2 but visibly is not.
sorry, I didn't rember it correctly. Maybe we do not need to drop python36
drop python 35 and python 36 will make is possible to add inline typing, then we can commpile it with cython or mypyc.