Migrating from Python 2.7 to Python 3

Migrating from Python 2.7 to Python 3

English | MP4 | AVC 1280×720 | AAC 48KHz 2ch | 2h 45m | 309 MB

Are you still using Python 2.7? Official support for this version ended in January 2020; upgrading is more important than ever. If you’ve been meaning to make the jump to Python 3, but aren’t entirely sure how to use the new features—or how to migrate your existing code—then this course is for you. Instructor Steven Lott illuminates the differences between the two Python versions, going over changes to built-in Python functions and the Python standard library. He also walks through a number of ways to convert your Python 2.7 applications to Python 3, including manual rewrite and automated migration using packages like six, pytest, and 2to3. Along the way, Steven shares his own experiences with this transition and offers helpful suggestions for enhancing the overall quality and performance of your code.

Topics include:

  • Comparing the two versions
  • Syntax changes introduced with Python 3
  • Changes to built-in functions
  • Changes to the Python standard library
  • Manually vs. automatically migrating to Python 3
  • Using six to handle class definitions
  • Using six with standard library changes
  • Unit testing with pytest
  • Automating migrations with 2to3
Table of Contents

1 Getting started with migrating Python
2 The challenges of migrating from Python 2 to 3
3 Historical overview
4 The official how to guide
5 The obvious differences in Python 3
6 The language syntax changes
7 Syntax changes that have to wait
8 Changes to the internal types
9 Changes to Python built-in functions
10 Changes to the Python standard library
11 Navigation among the strategies
12 Readying the toolbox
13 Manual rewrite
14 Automated migration via 2to3
15 Final cleanup
16 Overview of the features of six
17 Syntax wrapping with six
18 Handling class definitions with six
19 Using six to manage built-in functions
20 Using six with standard library changes
21 Overview of the goals of unit testing
22 Capturing Python 2 features as tests
23 Mocking and monkey patching
24 Design for testability
25 Bugs Fix or preserve
26 Overview of the features of 2to3
27 Syntax and class definitions
28 Built-ins and library migrations
29 Test automation with tox
30 Type checking with mypy
31 Final thoughts
32 Continuing on with Python 3