I've been perplexed as to why this hasnt been built in to the python runtime since day 1.
Python was first released in 1991.
And day 1 of when type hints was introduced was in 2014.
Type inference has been around (as in "used in programming languages") since the early 1970s.
In the beginning python hit a sweet spot: glue code that wasn't exactly write once, too difficult to do in bash, and too small to go all the way and use C++.
However, it was not without its own design issues.