[PyQt] Python v3 Status

Giovanni Bajo rasky at develer.com
Sat Apr 4 10:27:33 BST 2009

On Sat, 4 Apr 2009 11:17:11 +0200, Detlev Offenbach
<detlev at die-offenbachs.de> wrote:
> Hi,
> that is good news. Do you have any experience how the performance of
> programs 
> differ between Python v3 and Python v2. Are there any hints about how to 
> write a program, that runs with both variants of Python (e.g. writing 
> compatibility methods that e.g. turn print() calls into print statements
> for 
> v2 or that turn unicode() to str() for v3).

This is the migration path:

 * Upgrade to Python 2.6.
 * Declare Python 2.5 unsupported (which might or might not be a problem).
 * Start using all possibile __future__ imports in your code
(print_function, unicode_literals, etc.), adjusting all your code
 * Run your program using "python -3" and fix all the warnings it spouts,
by rephrasing your code.
 * At this point, if you run 2to3, you should get perfectly working python
3 code. You can keep editing the Python 2.6 version and machine-generate
the 3.x version until you drop support for 2.x.
 * If your generated 3.x code does not fully work, it might be a bug in any
of the following:
   * Missing warning in "python -3"
   * Missing converter code in 2to3
   * Bug in 2to3
   In this case, you should report this problem to Python developers with a
testcase, so that they can fix it.

Giovanni Bajo
Develer S.r.l.

More information about the PyQt mailing list