Cool New Features in Python 3.8: Summary
Congratulations on completing this course! With everything you’ve learned, should you upgrade to Python 3.8?
Let’s start with the simpler answer. If you want to try out any of the new features you have seen here, then you do need to be able to use Python 3.8. Tools like pyenv
and Anaconda make it easy to have several versions of Python installed side by side. Alternatively, you can run the official Python 3.8 Docker container. There is no downside to trying out Python 3.8 for yourself.
Now, for the more complicated questions. Should you upgrade your production environment to Python 3.8? Should you make your own project dependent on Python 3.8 to take advantage of the new features?
You should have very few issues running Python 3.7 code in Python 3.8. Upgrading your environment to run Python 3.8 is therefore quite safe, and you would be able to take advantage of the optimizations made in the new version. Different beta-versions of Python 3.8 have already been available for months, so hopefully most bugs are already squashed. However, if you want to be conservative, you might hold out until the first maintenance release (Python 3.8.1) is available.
Once you’ve upgraded your environment, you can start to experiment with features that are only in Python 3.8, such as assignment expressions and positional-only arguments. However, you should be conscious about whether other people depend on your code, as this will force them to upgrade their environment as well. Popular libraries will probably mostly support at least Python 3.6 for quite a while longer.
See Porting to Python 3.8 for more information about preparing your code for Python 3.8.
To download the code in this course, click the link below:
To download the slides in this course, click the link below:
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.
00:00 Congratulations. You’ve completed the course! This video is the conclusion and course review. After looking at Python 3.8, the big question is, “Should you upgrade?” If you haven’t tried it out yet, there’s a few different options and I’ll include links below the video.
00:16
If you just want to check out some of the new features you’ve seen here, you could use a tool like pyenv
or Anaconda. They make it easier to have several versions of Python installed side by side.
00:25 There’s also the official Python 3.8 Docker container. What should you do about your production environment? Beta versions of Python 3.8 have been available for months now, so there have been many Python users that have been putting it through its paces.
00:38 If you’re still nervous, you could hold out until the first maintenance release comes out of Python 3.8.1. As far as updating your code, I’ll include a link to the article Porting to Python 3.8.
00:50
It provides a lot more information about updating your code for the new version. Let me take you through a review of what you covered in this course. You started off with an intro and overview, then you started to learn about assignment expressions and what’s being called the walrus operator (:=
) and how this one operator allows you to assign and return a value in the same expression.
01:17 Next up, it was about positional-only arguments and how they might provide some flexibility in designing your own functions, and how they also complement keyword-only arguments.
01:31 Then you took a turn into type checking and covered four of Python 3.8’s more precise types, with literal types, typed dictionaries, final objects, and then protocols.
01:47 Then you learned about the new features of f-strings in Python 3.8, and how they can provide a simpler debugging tool.
01:57
You learned about the Python steering council and some of the history of how it was formed over the last year. Then you started to see a handful of new other features, such as metadata
from the importlib
library.
02:14
You got a chance to check out some of the new math
and statistics
functions.
02:25
You learned about SyntaxWarning
s that are provided in Python 3.8 when you’re using some potentially dubious code.
02:34 Then there were some optimizations that Python 3.8 provides—some to speed up your code, and others to reduce the size of the footprint. And then this conclusion and course review. From Real Python, I want to thank you for watching. Make sure that you practice with what you’ve learned.
celalaksu on Nov. 29, 2019
Thanks for the course :) It’s very useful to learn new features
hreves on Nov. 29, 2019
I am just learning Python and want to start with the latest version. I have been using version 3.7. So this was very helpful to me.
batronix on Nov. 30, 2019
Thank you for giving me this course to know the new features in Python 3.8
jojcarter50 on Nov. 30, 2019
Thanks for the course!
Jos Manuel Domnguez Romero on Dec. 1, 2019
Thank you very much for the course :)
excelsofts on Dec. 2, 2019
Cool, Thanks for the course!
Sneha Ram on Dec. 3, 2019
Thank you very much for the course :)
Luke Chen on Dec. 6, 2019
Thanks, it’s a wonderful course. I’m curious what vscode plugin you used to get those code prompts poped up while typing code on the terminal.
Chris Bailey RP Team on Dec. 6, 2019
Thanks Luke Chen, The tool I’m using in the terminal is a REPL replacement called Bpython. In that link it shows the “easy install” which is usually (python3 -m pip install bpython), but it may require a build library, I just re-installed my OS on my Mac and it required I update some xcode libraries, but it showed the link at that point. This is for it to compile bpython. Here is a video from Dan Bader on it.
Darryl R on Dec. 15, 2019
Very well done and thorough! Thanks!
Neeraj on Dec. 17, 2019
Thanks for the course. It was precise and to the point.
Mohamed Anis MANI on March 27, 2020
Thanks, the course was concise and clear!
johnbarney772 on March 27, 2020
thank you
utsun2015 on March 29, 2020
Thanks a lot.Great stuff.
ibrahim suleiman on March 29, 2020
nice of you guys thank you very very much
Paal Pedersen on April 2, 2020
Thanks alot! Very Nice Course. Lots of things I missed!
Prabhath Kota on May 3, 2020
Thanks for the article. Good to know debugging with fstrings in 3.8 & optimizations
DanielHao5 on May 9, 2020
Great intro to the new 3.8.
Wonder what’s the name of the cool REPL in all code demo? and where to get it?
Thanks. Daniel
Chris Bailey RP Team on May 12, 2020
Hi @DanielHao5,
The REPL tool is called bpython, I have links to more info on it below the second lesson. realpython.com/lessons/assignment-expressions/
negibson1 on May 13, 2020
Good overview. I am new to Python with 3.8. I enjoyed the review and learned some new things I will check into later: i.e., positional only arguments and walrus operator. Thanks.
zyxtech on May 13, 2020
Thanks for the course!
Marcelo Garbarino on June 5, 2020
Thank you for this course!
webr on April 2, 2021
Thanks!
Become a Member to join the conversation.
Marco Belo on Nov. 6, 2019
Cool, I do use a lot that print
f"variable={variable}"
to log what is happening, the new feature will sure help me.