
Port from Python 2 to Python 3 and decide whether to port or go polyglot. Learn changes in the language and libraries and gain guidance for Python 3 support.
Explain how Python 2 and Python 3 evolved in two parallel versions, from print as a statement to a function, and the 2008–2020 transition.
Evaluate porting from python 2 to python 3 by weighing end-of-life security updates, the new standard with async io, and the need for compatible dependencies.
Port Python 2 code to Python 3 with two to three, futurize, and six, including pasteurize, applying diffs, in-place updates, and producing polyglot code that runs on both versions.
Understand how text is represented as binary, from ASCII and code pages to Unicode, and why UTF-8, UTF-16, and UTF-32 affect string length.
Python 3 makes Unicode strings the default, streamlining non-ASCII text handling. Decode to Unicode early and encode to bytes late to preserve data integrity.
Examine how Python 3 treats byte strings as an immutable byte array and how encode and decode convert between Unicode and bytes, for porting from Python 2.
Refactor Python 2 code to drop basestring, embrace io.open with proper encoding for text and binary IO, and apply string interning with six or the future package for porting.
Learn how Python uses exceptions to separate failure handling from the main flow, with both old and new syntax for raising and catching exceptions, including polyglot patterns and 2to3 tools.
Explore how iterators work and how Python 3 changes their naming and usage, including next vs __next__, range as an iterator, and dict keys, values, and items becoming iterator-based.
Explore Python 3 file i/o with the io module and io.open, including buffered text and binary types, and porting guidance for Unicode handling.
Learn how Python 3's input returns a unicode string and replaces raw_input from Python 2, and how the future library can restore the old input behavior.
Replace execfile with exec(open(...).read()) and use the io library's string io for unicode text and bytes io for binary data to enable porting and polyglot compatibility.
Explore how the collections library was reorganized in Python 3, moving counter, ordered dict, userlist, and userstring into the collections module. Porting mainly requires renames and manual steps.
Learn how Python 3 reorganized and renamed the file-based dbm modules, including BSD and GNU dbm formats, and porting from Python 2 via 2to3 or future library for polyglot code.
Review how the hgp standard library portions were restructured in Python 3, with module renames but unchanged functions and classes, and how the future package enables polyglot porting by aliases.
Learn how to port python 2 to python 3 by exploring the itertools library. Understand why iterator-prefixed names changed and how python 3 returns iterators by default, including zip_longest.
Examine how standard library modules rename from Python 2 to Python 3, including socket server, config parser, and queue, and learn how six moves enable polyglot porting using future package.
Learn how repr becomes a formal, debuggable string representation when porting from Python 2 to Python 3, capable of parsing back into the original object, unlike str.
Understand relative imports and ambiguity when porting from Python 2 to Python 3, and learn how reload moves to importlib for robust package handling.
Porting from python 2 to python 3 changes dictionaries: replace has_key with the in operator, and iterate keys, values, and items as iterators, with polyglot support via the six library.
Porting from Python 2 to Python 3 explains how range returns an iterator in Python 3, xrange renamed to range, and how 2to3 and polyglot help porting.
Porting from Python 2 to Python 3 with functional operators map, zip, and filter, which now return iterators. Use two to three for porting and run future for polyglot code.
Porting from Python 2 to Python 3 explains reduce and comparisons, noting reduce moves to the phunk tools package, apply is removed, and key functions replace cmpd for sorting.
Review the journey through porting from Python 2 to Python 3 and reinforce your Python toolbelt with topics covered in this video series.
In this Porting from Python 2 to Python 3 training course, expert author Ben Straub teaches you about the changes with Python 3, and how to make a smooth transition from Python 2 to Python 3. This course is designed for users that already have Python programming experience.
You will start by learning about numbers and strings. From there, Ben teaches you about exceptions, such as raising and catching, and tracebacks and chaining. This video tutorial also covers classes, IO, and library. Finally, you will learn other language changes, such as print, imports and reload, ranges, and functional operators.
Once you have completed this computer based training course, you will have learned all about Python 3 changes, and how to make a smooth transition from Python 2 to Python 3.