I already have a library that is in Python 2.3. Is there any advantage to rewriting it to 2.6? [closed]
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
开发者_如何学Python Improve this questionOr, should we have a virutal environment and continue to run this on 2.3?
EDIT: I take it back; porting between different 2.x versions is not trivial. Note that raise "Oops"
worked in 2.5 but not in 2.6. However, the port should be pretty easy; for one thing, I believe that anything that would break in version n+1
will warn in n
, so you should be able to step through the versions. Alternatively, just change over and let your test suite catch everything =).
Given the choice, you might as well rewrite to Python 2.7, which is the latest (and final) 2.x version.
Here are the things that I can find that might break, from looking at the docs (2.6, 2.5, 2.4):
Previously valid variable names are now reserved keywords:
with as
Some builtins are shadowed:
set frozenset reversed sorted bytes
You can no longer
raise
a string.
There are probably others.
You need to weigh up the pros and cons of doing the port
2.5/6/7 gives you better programming structures, more libraries, etc.
but you won't know how much work is involved with the port until you try it.
I would imagine it's worthwhile spending say a day or two on the port If you feel you are getting nowhere after that time, careful reconsider whether the advantages will still make the port worth doing
精彩评论