Beginner needs advice
Thorsten Kampe
thorsten at thorstenkampe.de
Sat May 28 02:38:54 EDT 2011
* Thomas Rachel (Sat, 28 May 2011 07:06:53 +0200)
> Am 27.05.2011 17:52 schrieb Steven D'Aprano:
> > On Fri, 27 May 2011 09:40:53 -0500, harrismh777 wrote:
> >> 3.x is completely incompatible with 2.x (some call it a dialect,
> >> but that is a lie).
> >
> > "Completely incompatible"? A "lie"?
>
> Hard word, but it is true. Many things can and will fall on your feet
> when moving.
I think we should stop talking about (in)compatability because everyone
seems to associate something different with that term (incompatible =
"no Python2 to code will run with Python3", "not all Python2 code will
run with Python3").
The question is: if you want (or have) to run your code under Python3,
how likely is that it will run unmodified? My experience is: unless the
code is especially written with Python3 compatability or just a short
snippet, it's actually quite unlikely that it will run.
I modified three programs/modules (none of them written with Python3 in
mind - I was thinking that Python 3000 would come out some day after
Perl 6, PHP 6 and GNU Hurd; how could I know that the Python developers
actually mean business?)
One is a tool box kind of module. I had to insert lots of "list()" and
add a complete function that would deal with the different behaviour of
"sort". Probably easy to find the problems if you have extensive unit
tests but without it was a tedious nightmare.
The second a kind of script template. gettext.install has no "unicode =
True". Easy fix but I wondered why Python 3 does not ignore the keyword
simply.
The third, a more real world complete application using PyQt. Took me
about a day to fix. The problem was not just with the code but also with
the tools (pyuic4, pyrcc4). Without the PyQt mailing list this wouldn't
have been possible. Still: a complete workday (or even more) for 150
lines of code.
Thorsten
More information about the Python-list
mailing list