Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Cool New Features in Python 3.10 (Overview)

Python 3.10 is out! Volunteers have been working on the new version since May 2020 to bring you a better, faster, and more secure Python. As of October 4, 2021, the first official version is available.

Each new version of Python brings a host of changes. You can read about all of them in the documentation. Here, you’ll get to learn about the coolest new features.

In this course, you’ll learn about:

  • Debugging with more helpful and precise error messages
  • Using structural pattern matching to work with data structures
  • Adding more readable and more specific type hints
  • Checking the length of sequences when using zip()
  • Calculating multivariable statistics

Download

Sample Code (.zip)

38.6 KB

Download

Course Slides (.pdf)

5.3 MB

00:00 Welcome to Python 3.10: Cool New Features. My name is Chris and I will be your guide. In this course, you will learn all about the new features packed into the 3.10 release of Python, including better error messages, structural pattern matching, type hint improvements, changes to zip(), and new multivariable statistics methods.

00:25 Python 3.10 was released on October 4, 2021, and was actively being worked on since May of 2020. The key features of this release are: Better error messages—Python aims to be both powerful and beginner-friendly. Up until 3.10, a lot of the syntax error messages have been rather cryptic.

00:43 You might not notice them because you’re used to them, but if you ever stopped to read their contents, you might see how challenging it could be for a new coder.

00:51 Not only are the messages themselves a little confusing, but they often point to the line after the problem was triggered. Within most error messages, there’s a little pointer showing where on the line of code the error occurs.

01:03 In addition to improving indications of what line the error happens on, 3.10 also adds more accurate error highlighting with these pointers. The big new syntax structure in 3.10 is the pattern matching statement, which introduces two new keywords: match and case.

01:23 If you’ve come from another programming language that supports a switch statement, you’ll be familiar with the basics, but Python’s implementation goes far deeper than that.

01:33 There’s a whole bunch of type hint goodness in Python 3.10. There are improvements to unions, aliases, and guards, as well as better support for type hinting decorators.

01:44 There’s also a new introspection call allowing you to get information about annotations used for type hinting at runtime.

01:52 The standard library zip() method has a new parameter that makes it safer to use by raising an error if you attempt to zip things of unequal length.

02:00 And there are also three new functions in the statistics library: covariance(), correlation(), and linear_regression().

02:10 And finally, there are a whole host of small improvements like default text encodings, asynchronous iteration, multiple context managers, additions to the sys module giving info on the interpreter, and dropped support for older SSL.

02:28 In the next lesson, I’ll show you all the new ways the compiler will tell you you’re wrong—and that’s a good thing!

Become a Member to join the conversation.