How to write differently to remove this type hint in Python 2.7?
Mats Wichmann
mats at wichmann.us
Wed Oct 21 19:41:22 EDT 2020
On 10/21/20 3:24 PM, Shaozhong SHI wrote:
> Is there another way to do this?
>
> def greet(name: str) -> str:
> return "Hello, " + name
> greet
>
> File "<ipython-input-28-bee2cddf1f0d>", line 1 def greet(name: str) -> str:
> ^ SyntaxError: invalid syntax
>
The hinting pep PEP (484) has an alternate syntax that doesn't break 2.7.
More information about the Python-list
mailing list