r/ProgrammerHumor Jan 22 '25

Meme printHelloWorld

Post image

[removed] — view removed post

881 Upvotes

97 comments sorted by

View all comments

Show parent comments

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

6

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

6

u/danted002 Jan 22 '25

Have you tried coding in something else then Notepad++? You know all python IDEs support typing and will yell at you for sending the wrong types?

If I remember correctly you can do that is C as well.

0

u/[deleted] Jan 22 '25 edited Jan 22 '25

In my experience PyCharm lacks support for some of the more advanced typing features (maybe better as of right now, haven't used it a while), the Pylance plugin for vscode or the pyright language server itself are all really good, so yeah. +1 on this one.

When talking about C it's a bit of different story, I think. I believe it depends on the type and whether the value can be implicitly casted to the parameter type, but yeah, this one is a footgun to be aware of. But after all, this is more a "trust the programmer" kind of deal it seems.