Because Python3.0 (aka Python3000) has no backward compatibility, it is supposed to cause some trouble when porting existing code to Python3.0. According to PEP3000 (PEP stands for Python enhancement proposal) , there is a recommended procedure to port 2.x code to 3.0. This is a quote from PEP3000
- You should have excellent unit tests with close to full coverage.
- Port your project to Python 2.6.
- Turn on the Py3k warnings mode.
- Test and edit until no warnings remain.
- Use the 2to3 tool to convert this source code to 3.0 syntax. Do not manually edit the output!
- Test the converted source code under 3.0.
- If problems are found, make corrections to the 2.6 version of the source code and go back to step 3.
- When it's time to release, release separate 2.6 and 3.0 tarballs (or whatever archive form you use for releases).
For Python experts: did you know there's one byte code assigned just for PRINT_NEWLINE? No wonder Guido wanted to renew Python interpreter. You can see the list of byte codes here. (and compare it with Python3.0's byte code instructions, you'll see lots of them are simplified or generalized with arguments.)
by the way, is anybody reading this blog regularly? I'm just curious.
8 comments:
I read it for the first time today.
-Josh
Hi Josh, thanks for visiting!
Yeah I read it regularily.
Hey ger, cheers! thanx the other day.
I'm interested in so many things so I'll write about them bit by bit.
Thanks for posting these, I'm going to be porting some older Python code over soon!
you're welcome :)
I'm starting to read it regularly:)
it's good, very interested in your stuff you do. Just getting into python and 3d(for my job) and your blog is really cool to see whats possible.
Thanks captainhaha,
yeah it's interesting with little stuff you can glue most things together. I'll explore those stuff further.
Post a Comment