PEP 572 introduced Python’s walrus operator, also called assignment expressions.
The proposal added the `:=` syntax, which assigns a value while also allowing that value to be used as part of a larger expression. For example, `if (match := pattern.search(text)):` stores the search result and tests it in the same condition. This can reduce repeated calculations, especially in loops, filters, and comprehensions, although excessive use can make code harder to read.
PEP 572 was created in February 2018 and accepted for Python 3.8. Its authors included Chris Angelico, Tim Peters, and Guido van Rossum. The nickname “walrus operator” refers to the sideways appearance of `:=`, which resembles a walrus’s eyes and tusks.
The number is sometimes confused with other PEPs concerning syntax or assignment. PEP 8 covers style, PEP 3132 covers extended iterable unpacking, and PEP 634 concerns structural pattern matching. The walrus operator is an expression feature, so it is not a replacement for ordinary assignment statements in every situation.