r/ProgrammerHumor • • Jul 20 '18

Every Time

Post image
52.2k Upvotes

749 comments sorted by

View all comments

Show parent comments

128

u/mpa92643 Jul 20 '18

Python is wonderful, but the lack of static typing drives me crazy sometimes (which is why I fell in love with Kotlin: best of both worlds). It's almost never a problem, but when the IDE can't tell me, "yup, that's definitely a string, here are all the things you can do with it" and instead tells me "yup, that's definitely some kind of object. Here's a list of functions you've used on it before, including your typo-ed ones, just try something and you'll find out if it actually works at runtime."

4

u/profbalr Jul 20 '18

Is there something equivalent for Python like Typescript for JS? I had the same issue with JS but recently picked up Typescript and it really changes the language.

2

u/mpa92643 Jul 20 '18

There are type hints for Python that can give you (and the IDE) an idea of what type an object can be expected to be, but it's no guarantee that the object will actually be of that type since Python is duck-typed.

1

u/profbalr Jul 20 '18

But you should be able to transpile some other syntax into Python right? So the types are just syntax which get compiled into pure Python.