M
M
Meroving2012-06-06 22:27:46
linux
Meroving, 2012-06-06 22:27:46

Python/PyQt vs C++/Qt for .NET migration. What to choose?

I have been working with .NET (C#/F#) all my professional activity, I know, well… not bad, I had experience with Java and AS3 from other languages. Now there is such a situation that the customer (very powerful and arrogant) for ordering requires only programs for linux, and for strictly defined assemblies into which packages cannot be installed just like that (I think many guessed that we are talking about WSWS and AstraLinux, which have certificates MO). Of the development tools, there are only Qt (thank God, fresh enough), gcc and python.
Actually, the question is, if I am a priori about the same in both C ++ and Python (i.e. I can imagine what it is, but I have never programmed more than a couple of dozen lines), which is better to choose in terms of ease of development and minimization of opportunities to shoot myself in the foot ?
In PyQt, .ui files have to be constantly rebuilt into .py, as I understand it, edited in an external editor, and plus the dynamism scares me a little. Moreover, PyQt itself will have to be assembled from source on the final machine, well, that's okay.
On the other hand, with C ++, it’s also clear that after so many years of getting used to the same GC, it’s worth waiting for a lot of problems from it. Yes, and somehow it's a pity to part with all the functional goodies that seem to be available in pythone.
In deep thought.

Answer the question

In order to leave comments, you need to log in

10 answer(s)
S
ShpuntiK, 2012-06-06
@ShpuntiK

If python and c++ are the same for you under the given conditions, then I would choose si, if only because c# is very similar to it. Qt for c++ is a good option and the documentation is great.
I didn’t write in python, so I don’t know the pros and cons there.

B
BrainHacker, 2012-06-07
@BrainHacker

Definitely Python + PyQt. At least because:
1) it's hard to shoot yourself in the foot
2) a very large number of additional libraries for Python I
had experience writing a snout for a small database on Linux using Python + PyQt. Wrote overnight. On the plus side, I would squirm for a week just to bring out the window ...

L
ldir, 2012-06-07
@ldir

For Qt's native C++ language, the native documentation also describes the C++ version, Qt also provides assistance with memory management. If the task is responsible, then it is important that C ++ has static code checking and strong typing, while the Python program needs to be tested more thoroughly with full code coverage, otherwise any mistake can fire at the most inopportune moment

W
wrmax, 2012-06-06
@wrmax

Write a few words about the tasks that you plan to solve.
One of the projects in which I was involved used Python, there were performance problems and some of the libraries had to be rewritten in C ++.
I think it's worth switching to C ++, because. It is unlikely that you will be able to completely abandon it.

S
stepank, 2012-06-07
@stepank

it seems to me that first you need to determine what surprises can be with PyQt on target machines: how easy it is to install, whether you need to build it yourself from source, if necessary, then how difficult it is in that environment, whether you will do it yourself or who - something else. the fact is that if you have one or two machines to which you have direct access, you will completely master it with your hands, but what if there are several tens or (what if?) hundreds of machines? with pure Qt, there should be fewer problems in this regard
if you make sure that using PyQt on target machines is not difficult, take it, writing in python is very easy and comfortable, and bottlenecks can be identified in c / c ++ modules for python
also take a look at PySide, it has LGPL free licenses unlike PyQt's GPL, and they say it is generally more pythonic, although I have not worked with it

T
TyVik, 2012-06-07
@TyVik

I recently started writing in Python/PyQt myself. A few notes:
1. You can dynamically load ui files. 2. Don’t look towards PySide
yet - the license there is, of course, softer, but IMHO, the project is not yet sufficiently developed to be used in industrial products
to. there is no necessary library for working with QtDesigner yet.
And the implementation option on PyQt was not considered, but with its own libraries in C ++? Transfer critical parts to pyd files (by writing them in C ++), and draw the interface in Python.

A
Akson87, 2012-06-07
@Akson87

If very high performance is not important, then python, since after sharp and dotnet, you will have to think about memory, pointers and similar things that allow you to happily shoot out of the habit. And if HIGH performance is important, then there are no particular options, there are only pluses :)

A
Alexander Yudaev, 2012-06-07
@oYASo

In general, Qt itself is quite clumsy (fresh on Habré - speed test with containers ). But if you are programming in C ++, then you can easily write problem areas using the same boost, for example. But if you write in python, then not only will you lose performance on PyQt itself, but also what the hell can you do (except to write problem areas in C ++).
But after C#, it will be hard to switch to C++, that's a fact.

A
Alexey Akulovich, 2012-06-07
@AterCattus

Just for comparison:

QObject::connect(but,SIGNAL(clicked()),this,SLOT(copy()));
but.clicked.connect(self.copy)

And about more complex things in general I am silent:
task_done = QtCore.pyqtSignal( tuple )
...
self.task_done.connect( self._task_done, QtCore.Qt.QueuedConnection )
...
self.task_done.emit( ([], {}, 42) )

How much you need to write for this in C ++, I don’t even dare to say.

S
smashrod, 2012-06-07
@smashrod

You can add a good Makefile for ui and qrc, put the deploy-sequence there, and you’ll get happiness.
When it’s not critical that using Python + PyQt helps out well, you can do everything quickly with the designer and everything else, and most importantly, you can make a trace interceptor, then no error threatens, as they wrote above, “shoot in the foot”;)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question