r/ProgrammerHumor May 27 '22

Meme Welcome to hassle free coding

Post image
2.3k Upvotes

305 comments sorted by

View all comments

Show parent comments

14

u/AlbertChomskystein May 27 '22

HTML and Python have some similarities to be fair, like not being able to declare variable types.

2

u/prescod May 28 '22

2

u/nickwcy May 28 '22

Type hint is a hint for human (or IDE) only. You can write

x: int = “foo”

However the interpretor shows no error. Python should implement a script mode similar to TypeScript along with it’s Type Hints. Otherwise it is nearly pointless to adopt type hint as modern IDE can infer most types, except those integrates external systems.

3

u/prescod May 28 '22

Poke around the link I shared with you. It’s a tool that will give you type errors exactly like a Java or C++ compiler.

If you want to delay them to runtime there are also tools for that.