making python scripts backwards compatible

Ken Seehof kseehof at neuralintegrator.com
Sat May 4 20:43:27 EDT 2002


Shaleh wrote: 
> On 04-May-2002 J.Jacob wrote:
> > I would like to make a request.
> > 
> > Today I spent again some time converting python code.  It
> > was in the SimpleXMLRPCServer.py file.  I wanted to use it
> > remotely on another computer but it gave errors because of
> > list comprehension and using the "".method() syntax
> > instead of importing string.  The reason was that other
> > computer was still running python 1.5.2.  I could not
> > upgrade the remote computer (no root access) and even if i
> > could the problem would come up soon again when the
> > (mobile agent-)program relocated.
> > 
> 
> I agree, it is quite annoying.
> 
> It is pretty easy to write a python script to catch a lot of 
> this.  += and its
> friends can be programmatically turned into a = a + .. same goes 
> with string
> methods.
> 
> list comprehensions however require human intervention.  A bigger 
> problem is
> the change in scope rules.
> 
> I find it particularly annoying that the python group makes this 
> assumption we
> are all running last week's python.  Not everyone owns the machine their
> scripts run on.

That's a nice sentiment, but you need to keep in mind who creates
the code you are complaining about.

Occaisionally I make something available as open source.  Generally
the software is something I wrote to solve a particular problem for
me.  If I don't need it to run on python 1.5.2, it doesn't.  If I
had a policy of making all my code run on 1.5.2, I would simply
never download newer versions of python.  But I happen to like
some of the new features.

On the other hand, if people want their code to be usable by
others it doesn't hurt that much to make it run on some more
recent version.  Also, if you pay me to write python code for
you, I will use whatever version you want.

Making python programs run on 1.5.2 means not using any python
enhancements created in the last few years.  For some volunteer
programmers, that's too high a price to pay.

Perhaps a better solution in the long run would be to encourage
everyone to make sure none of their code runs on old python
versions.  This will eventually pressure people to upgrade :-)

This thread reminds me of a customer who was unwilling to upgrade
his CP/M machines, and was really annoyed that anyone would
create any of them newfangled machines :-)

Speaking of which, when's python for the Kaypro coming out?

Time marches on-ly yrs,
- Ken






More information about the Python-list mailing list