Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The way to start a migration is to first get the 2.7 code as forward compatible as possible. Bring in the future imports. Make sure equivalent iterators are used where 3.x mandates them (xrange, iterkeys, etc.). Make sure Unicode is managed correctly on I/O. Explicitly call out truncating division.

This doesn't require parallel testing. These all improve the quality of 2.x code even if you never make the leap to 3.x.

Once this is done you can use 2to3 to mechanically fix the remaining differences. Anything else that remains broken can be special-cased in the 2.7 code until 2to3 works without intervention.



2to3 never worked and will never work "without intervention".

That's why six and manual changes are always needed...


Using six is intervention. You end up with code that has one foot stuck in the past.


It requires parallel testing to make sure the files you've "future-proofed" aren't accidentally un-future-proofed by later commits.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: