Cool New Features in Python 3.9 (Summary)
The release of a new Python version is a big milestone for the community. You may not be able to start using the cool new features immediately, but in a few years Python 3.9 will be as widespread as Python 3.6 is today.
In this course, you’ve seen new features like:
zoneinfomodule for dealing with time zones
- Union operators that can update dictionaries
- More expressive decorator syntax
- Annotations that can be used for other things besides type hints
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.
In the previous lesson, I discussed the pros and cons of upgrading quickly. In this lesson, I’ll give you a quick summary of the course. The first topic was the
ZoneInfo class of the new
00:24 After that, I covered the new pipe and pipe equals operators for merging and updating dictionaries. Then I showed you the new decorator syntax that is far more flexible, allowing you to use general, callable expressions as your decorators.
Annotated class in the
typing library gives you the ability to add meta information to your type hints. Under the covers, one of the bigger changes in Python 3.9 is the change from an LL(1) to a PEG parser. This likely won’t impact you immediately, but allows the developers of Python to support syntax in the future that was very difficult before.
str (string) library has two new functions,
.removeprefix(), for removing the front and back part of a string. It’s now easier to use generics with type hints, as you no longer have to have special classes like capital-L
List in the typing process. You can just use the built-in
Become a Member to join the conversation.