Writing Python 2/3 compatible code
summary
Describes concrete migration work: a python-future library (≈37k LOC, 850 tests, ~1,150 commits) plus futurize/past scripts built on lib2to3 that successfully backport Python 3 behaviors into 2.6/2.7; recommends targeting Python 3.3+ and dropping <2.6 support, shows specific idioms (from future.builtins, future.moves, Six) that make print, bytes/str, division, iterators and stdlib imports behave the same, and reports the tools actually work on large codebases.
AI-written summary · about
chapters (12)
- 0:00Introduction to Python 2 vs 3
- 1:09State of Python 3 migration
- 3:51Benefits and pitfalls
- 7:29Resources for migration
- 10:18Single source compatibility
- 13:32Philosophy and design
- 17:29Built-ins and past package
- 20:32Practical coding idioms
- 25:32Handling bytes and strings
- 31:19Type checking and iterators
- 34:46Library and syntax management
- 38:55Conclusion and future steps
related talks
02h 38mMigration from Python 2 to 3
26mPython 2 is dead! Drag your old code into the modern age
26mPython 2 to 3: How to Upgrade and What Features to Start Using
44mHow to Build a Plan to Migrate to Python 3
31mIntroduce Syntax and History of Python from 2.4 to 3.6
24mJourney to migrate python2 projects to 3
01h 12mPython 3: the Next Generation (is here already)
43mPython 3: ten years later
