The Python Enhancement Proposal that introduced the walrus operator is PEP 572.
PEP 572, titled “Assignment Expressions,” proposed the `:=` syntax, which lets code assign a value to a variable inside a larger expression. For example, `if (match := pattern.search(text)):` stores the search result and tests it in the same condition. This can avoid repeating an expensive calculation or restructuring a loop.
The proposal was authored by Chris Angelico and Tim Peters and accepted for Python 3.8. During the discussion, the new operator became informally known as the “walrus operator” because `:=` resembles a walrus’s eyes and tusks. The formal terminology remains “assignment expression” or “named expression.”
PEP 8 is Python’s style guide, PEP 20 presents the Zen of Python, and PEP 484 introduced type hints. None of those created `:=`. The walrus operator also has restrictions: assignment expressions often need parentheses for clarity, and they are not interchangeable with ordinary assignment statements.