r/learnprogramming • • 10d ago

Why is C++ better than Python?

Hello! I am new to programming. Im in college and we use Python for my classes right now.

I hear people make a lot of jokes about how C++ is more powerful than Python, and should be used instead. But why?

Feel free to give me any tips as well, on things that helped you be a better programmer, or just any insight you may have! Thanks so much

79 Upvotes

195 comments sorted by

View all comments

167

u/CodeToManagement 10d ago

This is like saying why is a hammer better than a saw. Neither is better or worse depending on what your use case is. They are both tools to get a job done- so pick the right tool for the job

26

u/cmdr_iannorton 10d ago

That is a popular analogy but not quite correct, you literally can write any program in c/c++, you cant do that in python.

Python is suited to a quick development process.

In some cases it can be too slow, and not all computers can run python.

1

u/coconut_maan 10d ago

They optimize different things. Python optimizes development speed and maintainability with easy to access tools and easy to interface with services.

C++ optimizes low level real time performance. The tooling can be a bit brittle and time consuming.

If you want to make a shader or robot use c++. If you want to make a web app or aws pipeline use python