Daniel Fetchinson, 13.01.2010 17:30:
Again, django has been ported to python 3, that's fine, everybody
acknowledges that, but it's not the case that one code base works with
both python versions.

Well, if the port is done via 2to3, you can install the same code base in Python 2 and Python 3, and the distutils install mechanism will run an automated transformation over the code during the installation. If there is no manual interaction required to run the code on both platforms, I would say that qualifies as "one code base works with both Python versions". It's not different from generating code or specialised config files during the installation or similar things.


> I think django and cheetah
> doesn't count because they simply take their python 2 code, run it
> through 2to3 which gives them a python 3 code (I could be wrong
> though). Two codes for the two python versions.

But just one code base that has to be maintained. And I think the maintenance is the main aspect here.


Just to be clear I'm looking for an example where one given
code runs on python 2 and 3 unmodified.

lxml for example. Not only the Cython compiled part (which is automatically portable anyway), also all of its Python code base and its entire test suite. It runs on all Python versions from 2.3 through 3.1, and it doesn't use 2to3 or any other kind of code modification.

The regular Python code base was almost trivial to port, but porting the test suite was actually quite involved. The main reasons for that were a) doctests and b) the requirement to test exactly string input/output and exactly unicode input/output on both platforms. Most code simply doesn't have that requirement, but lxml does.

Stefan
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to