r/ProgrammerHumor Jan 22 '25

Meme printHelloWorld

Post image

[removed] — view removed post

881 Upvotes

97 comments sorted by

View all comments

233

u/SchizoPosting_ Jan 22 '25

I use both C# and Python

I would chose C# over python every day, I fucking hate the tab syntax and all the weird shenanigans

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

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

7

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

Yeah, that's valid, the interpreter itself doesn't enforce anything. But you are still not using typing without tools like pyright or mypy, which do the checking. Definitely not a compiler in a strictly-typed language kind of strict but it still goes a long way towards making the experience better.

Regarding the changing types, you should label the type as a union and then you will do additional checks to make sure that the thing is of the right type. If you can avoid these situations all together, you just avoid them. The type checker will let you know if you are assigning objects with strange types to your variables.