Python 3.8功能 (Python 3.8 Feature)
Walrus operator is the coolest feature that was added in the Python 3.8 update, the Python release that most of you are probably using right now. The operator :=
is called the walrus operator since it characterizes the look of the walrus. See the colon as eyes and the equal sign as its tusks.
Walrus运算符是Python 3.8更新中添加的最酷的功能,这是大多数人现在可能正在使用的Python版本。 :=
运算符称为海象运算符,因为它表征了海象的外观。 将结肠视为眼睛,将等号视为其牙。
The walrus operator is used as an assignment expression. It allows you to assign a value to a variable while also returning the value.
海象运算符用作赋值表达式。 它允许您为变量分配一个值,同时还返回该值。