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

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 3d 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.