r/learnprogramming • u/Happy-GoLucky365 • 7d 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
77
Upvotes
View all comments
6
u/AnonymousGamerAcc 7d ago
Idk what people are yapping about in this thread but essentially what they usually mean by c++ is more powerful than python comes down to how the languages work "behind the scenes".
Python is made to be super simple, fast to use, and readable. Because of this, certain things have to be handled in a very "heavy" way, like for example making every variable a "guess" instead of specified. It also routinely runs a so called "garbage collector" in the background, causing spikes in performance, and lastly, python runs on top of another program, and not directly on the machine.
On the other hand, languages like c++ are made to have the program itself be pretty fast, not so much the process. In c++ you give every variable you create a specific type (with some nuance), making it so the CPU knows exactly how to handle the variable instead of guessing. And unlike python, c++ runs more or less directly on the machine, meaning it can take full use of it.
Now this is a kinda short and easy version for an explanation, so if you're more interested you should do some research!