Monday, June 25, 2007

php 5.x is four years old. php 4 is still used. Pygame with py3k?

A cautionary tale for py3k planners from the php situation with php 4, and php 5.

php4 is still so popular and widely used, even after four years.

py3k should really study the php situation in order to avoid repeating those mistakes.

I don't think python has that much legacy code out there compared to php, but I still think there is enough that python2.4, 2.5, and 2.6 will be around with us for ages.

This page lists the reasons for php4 still hanging around. php is often installed by the web hosts, not by individuals. This is the main benefit for php versus python. Php is already installed. However as it is hard to run both php4 and php5 at the same time guess which one gets installed? Php 4 gets installed, because of all the legacy applications which require php 4. Since there are 20-1000 web pages on a single host, if only 5% require php4 then that's what will be installed. Some major webhosts have just upgraded to php4 this year!!! (Media temple) Many open source projects still support php4 since that is what most people are running. Most of them have finally been upgraded to support php 5, but still work best with php4.

Being able to run both php4 and php5 at the same time would have helped this situation a lot. This can be done with fcgi, but most hosts use mod_php. mod_php, like mod_python can only run one version of python at a time.

php 5.x has cleaned up a *lot* of things in php 4.x so I think the pain was worth it in the end, for some. For others it has created an extra four years of work, with still more work coming. I think py3k will have a bunch of things cleaned up to make it worthwhile too.

Many games written with pygame have little to no unittests. Even the best programmers who certainly are not 'dumb asses' do not write unittests for their games. It will be annoying to break pretty much all of the games on py3k, but py2.x will still be around to run those. Unlike with webhosts, most python game people can choose which python they use.

Pygame has a limited test suite. However we do have many programs to test against, with a large set of people who report bugs. The unittests for pygame are also slowly improving, so hopefully by the time of py3k, there will be plenty of unittests to help with the transition.

Will it be possible to support both 2.2, 2.3, 2.4, 2.5, 2.6 and py3k at the same time? At the moment we support >= 2.2 with python2.6 not having been even put in alpha yet, and py3k a long way away. We could probably drop support for python 2.2, and python 2.3 if needed. I don't think debian will do another stable release before py3k comes out, so python 2.4 will still have to be supported then.

Does anyone know how the C API will be for py3k? Is it going to be massively different? Every python release so far has broken the C api compatibility in some small way, so that's to be expected with py3k. I'm guessing it won't be all that much different though.

Or maybe py3k is the time to clean up the C API too? I haven't read anything about the C api, in the py3k plans, so I would like to know.


Doug Napoleone said...

Disclaimer: I am not a core developer. I just read the mailing lists.

There was some minor talk about doing a major cleanup of the python C/Api, but it died. The most dramatic changes will be centered around he new IO module and unicode strings.

Beyond that it looks like changes will be of the type we have come to expect (minor PyObject changes, etc). This should help to limit the impact the effects on third pardy extension models. It will be enough of a task to switch to Py3K on the interpreted side.

Tonetheman said...

Based on the amount of time it took for pygame to support python 2.5 on windows... that would make me think that once py3k comes out it would be at least a year or more before pygame came out with a release.

Of course 2.5 would still be used in that case. If you wanted to do pygame work during that time 2.5 would more than likely be your only choice.