Hacker News new | ask | show | jobs
by giancarlostoro 44 days ago
Python has had type hints for like... Oh 11 years now. Just like C# has introduced var and quicker ways to write less, to the point it almost looks like JavaScript sometimes, but its because we can infer types pretty easily now. Rust has a nice system as well, forcing method signatures to declare types, everything is easier to infer from this.

Introduced in 3.5 (2015)

https://docs.python.org/3/library/typing.html

2 comments

Having type hints as a feature is not the same as using them.
Yet many projects don't use them.

Sometimes they are wrong (as they are more like a comment than a compiler directive).

My first task in any project was to figure out why devs don't have error highlighting on for bad types (often it's "it was red so we turned it off"), but good luck forcing others who don't do type hunting to start doing it when "it slows us down".

I guess I'm spoiled in that I've done both Python and C# throughout my carreer.