Hacker News new | past | comments | ask | show | jobs | submit login

> The logic of type hint is not bad but sadly I think that type hint are making python source code messy and unreadable.

Compared to legacy Python, yes.

Compared to verbose language like Java, no. Python typing is equal or less verbose than Java (unless you use "var" in Java).




Python people legitimately upset they can't write every function like this now:

def func(data, *kwargs): """data: the data. kwargs: other data."""


# returns the result


Technically, Python typing is more verbose than Java because it uses more tokens. Compare these:

    Python: def foo(x: int, y: int) -> int:  return x + y

    Java: int foo(int x, int y) { return x + y; }
Python uses colons and arrows while Java uses positions to encode where the type should go.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: