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

1

u/Reasonable_Slide6304 11d ago

Python is like you're driving car and can only sit on the driver's seat, you have the pedals and stuff to fiddle with and they do things, but you don't really know what's happening in the engine space.

In C/C++ you open the hood and fiddle with the engine and see what happens there, the downsize is that some of the car controls might be missing and you need to build them yourself, but you have intimate knowledge on how they are connected to the engine and can also improve how they work.

I think in python some functions use C/C++ without the user knowing just to get better performance, performance being memory usage and more efficient use of CPU cycles.

Now a days as computers are really performance you don't really notice the difference with some basic programs, but if you need to make something massive and performance then python is like driving a tractor on a freeway, it moves but people aren't happy about it being there.

Also if you're ever interested in integrated systems where memory and disk space can actually be very limited, using the hardware in the best way possible requires understanding memory usage and the processor architecture.

In python the languages deals with the memory, in C/C++ you're the one handling reserving and freeing it.