3 ms·
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 use
by kevin_thibedeau 7y ago
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.
- coldtea 7y ago2to3 never worked and will never work "without intervention". That's why six and manual changes are always needed...
- kevin_thibedeau 7y agoUsing six is intervention. You end up with code that has one foot stuck in the past.
- alexhutcheson 7y agoIt requires parallel testing to make sure the files you've "future-proofed" aren't accidentally un-future-proofed by later commits.