Skip to main content Brad's PyNotes

Posts on Syntax

  1. PEP 572: The Walrus Operator - Assignment Expressions in Python

    TL;DR

    PEP 572 introduced the walrus operator (:=) in Python 3.8, allowing assignment within expressions to reduce code duplication and improve readability.

    Interesting!

    The walrus operator gets its name from its resemblance to a walrus face - the colon represents the eyes and the equals sign represents the tusks!