backwards-compatibility

Jason Swails jason.swails at gmail.com
Sat Feb 26 08:11:40 EST 2011


Hello,

I have a question I was having a difficult time finding with a quick google
search, so I figured someone on here might know.  For the sake of backwards
compatibility (and supporting systems whose default python is OLD), I'd like
to rewrite some code to be compliant with Pythons as old as 2.4.  For this
reason I've already had to do away with all "{1}".format(item), but I'm
running into new problems with the packages I've written.  For instance, I
have a package "package1" with "subpackage1".  One of the modules in
subpackage1 imports the exceptions module from package1, and I do that like
this:

from ..exceptions import MyException

Which is perfectly fine by python2.5, 2.6, and 2.7; but unacceptable in
python2.4.  Any thoughts?

Another python2.6 feature I'm using is

except Exception as err:
   print err

Is there any way of rewriting this so I can still print the error message in
python2.5/2.4?

Thanks!
Jason

-- 
Jason M. Swails
Quantum Theory Project,
University of Florida
Ph.D. Candidate
352-392-4032
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110226/d8d35e0f/attachment.html>


More information about the Python-list mailing list