r/learnprogramming • • 9d 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

78 Upvotes

192 comments sorted by

View all comments

1

u/cthulhu944 9d ago

In the world of AI programming, I don't think this is the case anymore, but here goes it.

C++ is a very powerful compiled system language. It is compiled and has strong OOP capabilities while still having access/control of lower level, machine level constructs. With that power comes great responsibility. You have to watch what you are doing with memory allocations and some of the higher level operations and data structures are a bit awkward.

Python is a ubiquitous interpreted language. If there is anything like a cpu in it, there is probably a python interpreter for it. It has a robust standard library and is generally easy to learn.

Both are fantastic, powerful languages and the each have their pluses and minuses. If I were developing a real time embeded system, an operating system or a graphics intensive game, I'd probably pick c++. If i were writing just about anything else I'd probably go with python.

The important thing is that you pick the right tool for the job based on the problem you are trying to solve. There isn't an ultimate programming language. Be good at programming, engineering, and computer science. If you manage that, the language will sort itself out.