How to Use the Walrus Operator in Python to Improve Your Code | Python Tips For Beginners

preview_player
Показать описание
Assignment Expression, also known as the Walrus Operator, is a new Python syntax introduced as of Python 3.8 to solve common cases of code duplication and improve your code's readability.

In this video, I answer the following questions:

- What is the walrus operator and how does it work?
- How to use the walrus operator in loops and conditions?
- What are some benefits of using the walrus operator?
- When should I use the walrus operator instead of traditional assignment statements?

If you want to learn more about knowledge like this, I recommend this book:

TIMESTAMPS
00:00 Start
00:10 Background/Overview
1:55 Example 1a
5:10 Example 1b
6:20 Example 2
10:03 Outro
Рекомендации по теме
Комментарии
Автор

Another reason C is better than Python: the left side of an assignment is automagically evaluated when that assignment is part of a conditional. No need for the walrus.

nicomp
welcome to shbcf.ru