Whats New in Python 3.8
Tags: python
Published: 2019-11-09 10:56:37

---
title: Whats New in Python 3.8
tags: python
cover_image: https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fyourdevops.org%2Fwp-content%2Fuploads%2F2019%2F03%2Fpython3.jpg&f=1&nofb=1
published: true
---

Code is always changing and evolving - and its important that you can keep up with it! 

While you'll still be able to write with your older knowledge (its not as if they're about to break all of the old apps we use just because they've found a better way to do things), using the new features and tactics that are introduced in new versions will help increase your efficiency. 

Youll also be able to do more things with your code, which is always exciting!

That being said, its important that you stay on top of all the new features that <a href="https://python.org">Python</a> rolls out. This is a great way to give yourself an edge over other Python programmers and really make your code shine. 

So without further ado, lets dive into the new updates in Python 3.8!

## The Walrus Operator

Of all the features added to Pythons 3.8 version, this is really something to be excited about! Python has created a walrus operator :=  that allows you to assign values to a variable as part of an expression. There are a lot of cool things about this, but the best aspect is definitely the lines of code youll save while you make your apps. 

Now, instead of writing this: 

```python
    line = f.readline() 
    while line: 
	line = f.readline()
```
You can write this: 
```python
    while line := f.readline ():
```
See? Much better!

<img src="https://thumbs.gfycat.com/LikelyPoliticalAmberpenshell.webp">

## We Can Finally Simplify Iterable Unpacking for Return and Yield!

Anyone who has worked with Python in the past knows that Python 3.2 brought about an interesting problem that altered unpacking <a href="https://pythonbasics.org/iterable/">iterables</a> without parentheses in return and yield statements. There was, of course, a solution. But it took up extra lines of code - and we all know what a pain that can be.  

Before we explore what the fix looks like (finally!), lets take a look at the before and after for this feature. 

Before, you could only write something among the lines of the following code: 
```python
def  foo(): 
	rest = (4, 5, 6)
	t = 1, 2, 3, * rest
	return t
```
If you tried to plug in the following code, however, youd return an error code. 
```python
def baz(): 
	rest = (4, 5, 6)
	return = 1, 2, 3, *rest 
```
And you certainly couldnt write the following code. 
```python
def baz(): 
	rest = (4, 5, 6)
	yield = 1, 2, 3, *rest
```
In the new version, however, both of these will be accepted without returning any traceback errors! Yes! Its about time! Youll be able to save time writing code and focus on more important coding issues. 

<img src="https://thumbs.gfycat.com/GrayYawningDunnart.webp">

## Tell me more

There are tons of fantastic new features that have been rolled out with the introduction of Python 3.8. You can spend countless hours exploring all of the new features and the impact it will have on new code you generate. 

To make sure you fully understand how to integrate Python 3.8 into your work, check out more new features by visiting <a href="https://python.org">python.org</a>. You can also look at how Google, Firefox, and other platforms are using the new changes in their software - you may just find more awesome easter eggs! 

**Related links**
* <a href="https://docs.python.org/3/whatsnew/3.8.html">Whats new in Python 3.8</a>
* <a href="https://pythonbasics.org/">Learn Python programming</a>