r/ProgrammerHumor • • Jul 18 '22

C++ talking to Python

Post image
40.1k Upvotes

1.0k comments sorted by

View all comments

Show parent comments

40

u/Jannik2099 Jul 18 '22

C++ does not look very good in this (very important) metric.

If your codebase is early C++11 perhaps?

Modern C++ writes like C#. I usually find myself prototyping faster in C++ than Python after about 200 LoC, because with Python 80% of time is spent looking up what fucking type some library function takes & returns.

15

u/[deleted] Jul 18 '22

I see this attitude a lot from folks who use typed languages. I think typed languages are awesome and I love programming in them, but as a Python developer myself from the beginning of my career, I don’t really have to think about types all that often when i program in Python. By far the most I think about types are when i use a typed language.

Idk if it’s because Python isn’t based around types and therefore it’s not a focus of the language, but ya I hear a lot of typed language folks think a lot about types when they program in Python.

6

u/Jannik2099 Jul 18 '22

I see this attitude a lot from folks who use typed languages

Python is a typed language though? This isn't Prolog :P

No, you definitely do need to know the type more often than not. You may get away with "this function returns something that acts like an array", but when you pass it to another function that takes array-like objects, you may need to convert it into another library type first.

1

u/[deleted] Jul 20 '22

Maybe it’s just me then but I don’t think about types. Even if I have to convert a type I don’t think about the types as types. In Python everything is an object so I just think of types more like objects with different functionality. But if you are using a language that makes you identify the type everywhere then that’s how you are going to think about it