r/learnprogramming • u/Happy-GoLucky365 • 5d 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
67
Upvotes
View all comments
Show parent comment
-1
u/vegan_antitheist 5d ago
Does it? Compare to Python it certainly does. But it's high level compared to assembly.
I don't think that's a good idea. Beginners just end up on some shitty website written by beginners who don't know shit, or someone just writing to get traffic to sell more ads who also doesn't know shit. And it would be misleading if it claims that it's different. Some Python implementations have JIT and then a simple loop should be just as fast. Too simplistic loops might even end up replaced by a constant by a good C++ compiler. Then the time complexity is literally O(0). You probably don't get that in Python even with JIT. It doesn't even optimise tail recursion as far as I know and the reason is that debugging would be confusing when your recursion doesn't actually do any recursion.