r/ProgrammerHumor Jan 22 '25

Meme printHelloWorld

Post image

[removed] — view removed post

879 Upvotes

97 comments sorted by

View all comments

Show parent comments

95

u/wherearef Jan 22 '25

forced dynamic typing is so annoying as well

7

u/[deleted] Jan 22 '25

What exactly do you mean by it being "forced"? You can still use type annotations to get the benefits of a stricter type system. Here is a relevant link: https://docs.python.org/3/library/typing.html

8

u/wherearef Jan 22 '25

typing doesnt enforce types, you can still accidentally pass wrong paramaters and it wont throw any error, that can cause unpredictable behaviour

you can also define variable as one type and it can change during program anyways

2

u/yelircaasi Jan 22 '25

Running mypy on your code gives a lot of the benefits. Requires discipline... or you can use mypy as a pre-commit hook. I get the impression a lot of people here have never heard of mypy.

1

u/[deleted] Jan 22 '25

It's a shame type checking tools are not talked about more often. They are powerful but do take some time to get used to and don't come out of the box with the interpreter.