DEV Community

Discussion on: Python vs C++

Collapse
 
codemouse92 profile image
Jason C. McDonald • Edited

Nice rundown, overall.

However, as an expert in both languages, allow me to lend a bit of insight to a few points...

Someone will claim that Python have tools to convert source code into binary...

Nooooooooooot quite. These tools only bundle the Python interpreter binary with the Python source code, which is often (but not always) pre-converted to bytecode to save the interpreter some runtime parsing.

...till now I have not encountered a single tool that perform the task as it should be done, and if it exists it will needs many tweaks.

I've been able to ship executables created from cxFreeze, py2exe, and PyInstaller without any "tweaks"...but of course, your mileage may vary. And remember, you're not creating a formal binary in ANY case (see above).

...performance side Python gives worst results because it's not designed in essence to enhance performance but to increase developer productivity, this down side is the cost of the excellent productivity of the language.

Not quite. You're thinking of CPython, the default implementation of the langauge. Pypy, which is bootstrapped (written in itself) doesn't have this issue.

Python needs higher memory footprint and more CPU.

Again, not necessarily the case, especially with Pypy.

We shall not forget about multithreaded tasks, Python without external libraries written in C is unable to use the full multiprogramming capacities of the CPU because of its global locking.

Right now, there's some talk in Pypy about killing the global lock. Not sure what the status is, but I would be surprised if it didn't gain traction. Multiprocessing in Python is increasingly common.

Collapse
 
manimanis profile image
Mohamed Anis MANI

I want to thank you for the nice reply.

I have had very bad time once when I tried to create an executable for the Qt program I have written in CPython. Finally, when I succeeded I realized that the tool cannot package all the needed dependencies in one EXE file.

I am almost using CPython. I used IronPython with C# and I left it because it's very very slow in my machine. I used Jython too. But never used PyPy.

Collapse
 
codemouse92 profile image
Jason C. McDonald

Ye-ah, packaging a program with a GUI is sometimes quite painful with Python, especially back with Python 2. I like to think it's gotten better....ish?