[Python-3000] Python incompatibility test project.
Lennart Regebro
regebro at gmail.com
Sun May 18 16:38:01 CEST 2008
Hi all!
I have created a project to make tests for all incompatibilities
between Python 2.5, 2.6 and 3.0. It's hosted on Google code:
http://code.google.com/p/python-incompatibility/
It currently contains what I believe to be complete tests of language
incompatibilities. It also contains example code of how to avoid the
incompatibility if possible and hence write code running under both
2.6 and 3.0.
Files called test_something25.py runs under Python 2.5, and 2.6 but
should fail under Python 3.0.
Files called test_something30.py runs under Python 3.0, but should
fail under Python 2.5.
Files called test_something26.py runs under Python 2.6 and Python 3.0.
It also contains a test runner, runtest.py, and another testrunner
that prints out the test in a nice grid, called makereport.py. Both
these run under python2.4 to 3.0. makereport.py requires you to have
python2.5, python2.6 and python3.0 installed in the path.
There is as of today no tests of the standard library changes, but I
would like to have it. Help with this is appreciated, ask and ye shall
receive commit rights. :) I could also have missed some language
incompatibility.
The report output as of just now is:
Python 2.5 code Python 2.6
code Python 3.0 code
Group Test 2.5 2.6 3.0 2.5 2.6 3.0
2.5 2.6 3.0
classic_classes MRO Y Y N Y Y Y
N N Y
class_type Y Y N Y Y Y
- - -
dict dynamic_key_views - - - - - -
N N Y
iterator Y Y N Y Y Y
N N Y
slicing Y Y N Y Y Y
- - -
sorting Y Y N Y Y Y
- - -
division division Y Y N Y Y Y
N N Y
exception_syntax exception_syntax Y Y N N Y Y
N Y Y
filter filter Y Y N Y Y Y
- - -
long long Y Y N Y Y Y
N N Y
map map Y Y N Y Y Y
- - -
print print_file Y Y N N Y Y
N N Y
print_stdout Y Y N N Y Y
N N Y
range range Y Y N Y Y Y
- - -
reduce reduce Y Y N N Y Y
N Y Y
sort sort Y Y N Y Y Y
- - -
sorted Y Y N Y Y Y
- - -
string_exceptions string_exceptions Y N N - - -
- - -
unicode unicode Y Y N N Y Y
N N Y
xrange xrange Y Y N Y Y Y
N N Y
Note the following:
- All 2.6 tests run under both 2.6 and 3.0. Python3 is not so
incompatible as rumour has it. :-)
- There are less tests for 3.0 than for 2.5. Much of the
incompatibility for 3.0 is that you can't do some bad programming that
you could in 2.x. For example you can't do "adict.keys()[5]" in 3.0.
But why on earth would you misuse dicts like that? :-) Python 3 will
force you to write good code in some cases where you in 2.5 can write
bad code. :-) So the better your code, the easier to port to Python 3.
;.)
Feedback and help is greatly appreciated! No Python 3 experience
necessary, this is a fun way to get to know Python 3!
--
Lennart Regebro: Zope and Plone consulting.
http://www.colliberty.com/
+33 661 58 14 64
More information about the Python-3000
mailing list