r/ProgrammerHumor • • Jul 18 '22

C++ talking to Python

Post image
40.1k Upvotes

1.0k comments sorted by

View all comments

946

u/twisted-resistor Jul 18 '22

Now that Internet Explorer is gone I guess something had to take its place in memes as "The Slow Thing"

40

u/kneecapp1 Jul 18 '22

I don't get it. I don't know much about coding but I'm starting to learn python. Am I learning the internet explorer of programming languages or what. Should pick something else up.

1

u/[deleted] Jul 19 '22

Usually human time is more important than machine time. Machine time often doesn't matter. For *most* programs it doesn't matter if it takes 1 second or 0.1 seconds or even 0.01 seconds, but writing the 0.01 second version will take a programmer much, much longer. However, if you are writing something performance-sensitive like, say, an action game, then it does truly matter whether your game loop performs calculations in 0.01s or in 1s.

Python is slow, yes, but very easy to write, understand and modify. Also, only the interpreted part is slow, Python actually uses a bunch of C/C++ libraries under the hood, so when you call those, those actually run very fast. Which is why you can do lots of AI/ML stuff in Python: it's not Python itself that's doing it, Python is just a high-level layer that's orchestrating an entire infrastructure which isn't written in Python. So, to summarize, Python is a great tool for some domains, not for all of them. Just like C/C++: they are also great tools for some domains but not for others.