Python3.8 - The Walrus Operator

Developers
Python3.8 - The Walrus Operator

In Python 3.8, we will be able to use assignment as a part of the large expressions. It has a new syntax :=


Examples:

1. if-else block

Python3.8

< Python3.8


2. In while-loop:

Python3.8


< Python3.8


here we save one line by using the Walrus Operator.


3. In for-loops:


Python 3.8


< Python 3.8

Notice that this is not a good practise as we need to call call_some_function(number) twice in the comprehension.

Outsource the best Development team now!

You know what a great tech team can do to your business. It is time to act fast and outsource the best one. But who to pick or choose? MarsDevs got your back!

We have a team of developers who can build, deploy, and manage applications for you so that you can focus on the business better. As soon as you register, our expertise becomes yours! 

Do you have a project for us? We must connect as you can then share your requirements while we share our experience. You can book your slot now!

Subscribe to our news letter to receive latest updates!

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.