Nicolas Lehuen writes: > I've just checked in some changes to the Python source code in order > to support Python 2.2. Now the test suite runs successfully on Python > 2.2.3 on Windows 2000. I've checked that no regressions were > introduced in later Python versions, too. > > The changes are pretty simple : each Python module now features a > "from python22 import *". The mod_python.python22 module just > reimplements new builtins from Python 2.3. It turns out that the only > missing builtin for now is enumerate(). The tests module, containing a > few tests for generators, has to sport a "from __future__ import > generators" line. > > I also had to change mod_python.cache which used time.strptime so that > it uses rfc822.parsedate, now. > > I've did this because the guys from Nokia use Python 2.2 and > mod_python 3.1.3. They spotted memory leaks which are likely to be > fixed in mod_python 3.2.X, but they could not upgrade if Python 2.2 > was not supported.
But does this scale over the life of a project? Every new python module has to include 'from python22 import *'?? While never shying away from a decent hack myself, this is a hack that affects everyone, not just those that need the hack, which, for me, screams volumes. Certainly, which version of python mod_python is based on should not be taken lightly. Was it formally decided to make mod_python dependent on 2.3+? If not, then perhaps uses of enumerate, etc. should not be used. If a formal decision was made, then it's a done deal, right? If not and uses of 2.3 have slipped in then perhaps it's a done deal anyway because no one can stomach the thought of taking out the 2.3-isms at this late date. Regardless, I do not think it is within the scope of mod_python developers to keep users forward-compatible with the underlying python version. Sorry, but IMHO, this is not scalable software engineering. That said, I don't have a problem helping 2.2 users write their own hacks. For example, let's take enumerate...another way of solving this problem without touching any mod_python code would be a suggestion in the FAQ to write a module, say, python22hacks.py: ------------------------------------------------------------ # python22hacks.py # # This is unsupported software offered to mod_python users who are # stuck using python 2.2. # # Install by placing this module in the same directory with other # mod_python modules and add the following to your apache config: # # PythonImport python22hacks INTERPRETER_NAME # # More disclaimers, blah, blah... import __builtin__ as hack hack.enumerate = lambda s: zip(xrange(len(s)), s) ------------------------------------------------------------ This way we don't have to touch every module of source code and the onus is on the few who need it rather than the many who don't or those who have to maintain it. Cheers, Daniel Popowich --------------- http://home.comcast.net/~d.popowich/mpservlets/