[PyQt] PyQt4 and Python 3.0
david at boddie.org.uk
Tue Oct 7 21:09:19 BST 2008
On Tue Oct 7 19:47:00 BST 2008, Daniel Miller wrote:
> On Oct 7, 2008, at 12:54 PM, Phil Thompson wrote:
> > PyQt3 has always maintained backwards compatibility, so has PyQt4.
> > PyQt3 is not PyQt4. Likewise Qt3 is not Qt4. Granted, Trolltech
> > produced a Qt3=>Qt4 migration tool, but then they have orders of
> > magnitude more development resources and charge a lot more money for
> > their product.
> You have a good point there. I should apologize for being so harsh. I
> guess I'm just frustrated that I have to do so much work to get to
> the point where I can actually start using PyQt4. I am really looking
> forward to it...
It's good to hear that you _are_ looking forward to using it, and see
the advantages. You seem to be aware of the differences in style between
the two versions, and that will be very useful.
Although you're having to port to PyQt4 as the result of a Qt 4 feature
(Graphics View), you're quite fortunate to be porting be able to port this
late in the Qt 4.x series when most of the feature gaps of Qt 4.0 have been
> > Every place? Surely you only use QSettings in one place?
> Well, yes of course. Sorry for picking a bad example. How about
> QSplitter, QPushButton, QProgressBar, QPopumMenu, etc. Those are
> definitely used in many places, and the API for each of them changed.
> I realize this is not your fault--it was a decision made by
> Trolltech. However, I feel like they did more to help their users
> migrate old code bases to Qt4.
That's a matter of perspective. Certainly, there are developers out there
who think more could have been done, and the impression was sometimes
given that porting code from Qt 3 to Qt 4 wasn't a big deal, though it
very much depends on the code being ported.
[Changing the subject slightly...]
It's interesting to compare the advice about migrating code from Python 2
to Python 3 with the advice about moving from Qt 3 to Qt 4. The official
position about porting to Qt 4 was always that you would have to make a
clean break at some point and maintain two versions of an application,
maybe dropping support for the Qt 3 version at some point in the future.
With Python, the received wisdom seems to be that you maintain some version
(presumably against Python 2.6) that can be repeatedly ported using 2to3,
which I think sounds like a lot of work and is unlikely to be feasible for
some projects. At some point in the future, you stop maintaining the version
for Python 2.
The assumption is that Python 3 is just an upgrade to Python 2, and that
everyone keeps moving on the upgrade path, but what experience with Qt 3 and
Qt 4 has shown is that many people only migrate to get access to new
features or because the older version is no longer viable for some reason.
As long as everyone is clear about the benefits of Python 3 and is aware of
the differences, a lot of disappointment can be avoided. Whether or not
it makes sense to change PyQt4 to suit Python 3 better, other projects are
going to take the chance to throw away old code, and it may make sense to
rewrite applications and libraries regardless of how well they were
More information about the PyQt