by RodericDay · 10y ago · 0 comments
sum_and_stringify(nums: List[int]) -> str:
This looks so bad. I think Python is making a big mistake with this.The commented version is much more acceptable.
----
It should work with the Python 3 syntax if you quote your type annotation. I.e.
def f() -> "Bar": ...
instead of def f() -> Bar: ...
---Yeah, you need to write `from typing import List` to get the generic List class that you can parameterize with an item type. As you pointed out, you can use the builtin lowercase-l list without importing anything, but that doesn't allow you to specify the item type.
---
imo, this is brutal. I'll just wait and see whether I'm proven right or wrong, but the extremely poor aesthetics of the whole thing bode badly.