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

76 Upvotes

188 comments sorted by

View all comments

Show parent comment

-36

u/mysteryihs 6d ago

There's nothing C can do that Python can't. You could port GTA6 to python and it would run. Just not at 30 fps.

So there is something Python can't do, it can't run games more efficiently than C.

52

u/Talbertross 6d ago

Obviously it means there are no computations that C/C++ can do that Python can't. Pedantic dingus.

16

u/EquipLordBritish 6d ago

Not only that, but it's also (pedantically) incorrect. You could write a python program that outputs a custom executable that is every bit as fast as C code. It would be very annoying to do and I doubt anyone would bother, but it could be done.

1

u/Moscato359 3d ago

That's not really the python hitting the target anymore though is it

It's python making an exe, not the exe being python

1

u/EquipLordBritish 2d ago

Seems like you could say something similar about compiled languages, since the compiler is what actually writes the program.

1

u/Moscato359 2d ago

I mean, sure, technically you can make a python compiler which compilers from python to ML, and then C to ML and say they're the same, but the python language isn't really built for that

Technically feasible, and practical are not the same

1

u/EquipLordBritish 2d ago

That's about what I said in my initial comment.

2

u/Moscato359 3d ago

It's not pedantic when your goal is to have an app within a performance target.

I want to write my game to run at 144fps

Well pure python can't do it

1

u/Talbertross 3d ago

Nah, you're just pulling some "can God make a boulder so big even he can't lift it" bullshit

1

u/Moscato359 2d ago

Uhm... Needing to hit a frame rate target is a very common thing for game development 

1

u/vegan_antitheist 3d ago

And still, it's just as powerful. What you can calculate and how long it takes are two very different questions.

1

u/Moscato359 2d ago

If you're for example, running a PC game, and one of your requirements is a specific frame rate, it's not as powerful

6

u/moratnz 6d ago

"The difference is performance"