Python vs C++ (personal experiences with using both)

in terms of security, i.e. exploitability, python code is safer because you simply can’t make a large class of errors that you can in C++.

it can also not be claimed that python is somehow more prone to bugs or crashes than C++. in fact, the Python language is less convoluted and easier to grasp in its entirety than C++.

hiding your source code from the customer can be a valid concern. you can do that to Python code.

you shouldn’t write your own pixel manipulation loops. if you do, write an OpenCL kernel. OpenCL runs on CPUs and GPUs. if you write C++, it’ll only ever run on CPUs.

both for obfuscation and for optimization, you should look at Cython. it is a language and a compiler/translator. it is a derivative of Python that can be compiled to run as fast as C, if you add appropriate static types the compiler can optimize for. if you have to write your own pixel manipulation loops, use Cython.

I can’t recommend C++ to anyone for any purpose, and the only excuses are masochism and peer pressure. in terms of how dirty the programmer can get, it’s worse than C, perl, php, bash, … you name it, C++ is worse.

example: in C you can’t have reference counting. in Java and Python, you have garbage collection everywhere, and refcounting is implicit in that. in C++ however, if you want refcounting, you’ll have to dirty all your code with shared_ptr<stuff> everywhere.

that is visual noise. and it’s just one example of C++. this puts needless cognitive load on you and anyone who has to read that source code.

C++ is leaking abstractions all over the place. it is high level assembly language. it is what other languages are written in. you should only write C++ if your time as a human being is worth very little or someone pays you for the pain and suffering.

1 Like