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

196 comments sorted by

View all comments

Show parent comment

4

u/no_more_cat_pics_pls 9d ago

Python can't be used for kernal or OS programming and it's lack of strong typing and no memory management make it much more prone to bugs and slower. You need very specific languages for certain things. C can't be used for websites like HTML but you can't just say they are turning complete and equal

3

u/vegan_antitheist 9d ago

Again: Both are Turing complete. There's nothing one can do the other can't. It doesn't matter how much some people want to deny this. I wouldn't even need examples to prove this, but those examples exist:

C can be and probably still is used for html. CGI programs built in C weren't even that uncommon in the 1990s. Amazon was just one example of a website made with C.

Amazon's first engineers coded in a computer language called C and decided to store the website in an off-the-shelf database called Berkeley DB

Source: The Everything Store: Jeff Bezos and the Age of Amazon (Brad Stone, 2012)

PythonOS is described as:

A bare-metal operating system where CPython 3.14 is the kernel — not a program running on an OS, but the OS itself.

Source: https://github.com/jordanhubbard/pythonos

1

u/cmdr_iannorton 4d ago

Python is a virtual machine, at runtime your python code is compiled to python bytecode, you are controlling this machine, the machine itself could by a c program (cpython) or even a .net program (ipython) but ultimately you are writing for the python interpreter not a cpu.

python includes its own compiler, simply implementing eval and reflection is something huge. a 1 line program that uses eval() needs the whole python interpreter and compiler. except for very specific hardware, python isnt going to be used for low level stuff

1

u/vegan_antitheist 4d ago

And yet, you can do all that in Python. Brainfuck, C, Java, or any other programming language. The statement "you literally can write any program in c/c++, you cant do that in python" is simply wrong. You can write any program in python.

1

u/no_more_cat_pics_pls 8d ago

Cool, sure a bike and a mustang can also both technically get you to the same place. Why not, both have wheels and theres nothing one can do that the other cant right?

1

u/parautenbach 6d ago

That’s a completely different argument from your previous one.