Skip to main content Brad's PyNotes

Posts

2025

  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!

  2. PEP 8: The Python Style Guide That Rules Them All

    TL;DR

    PEP 8 defines Python’s official coding style guide, emphasizing readability with 4-space indentation, descriptive naming conventions, and the principle that “code is read much more often than it is written.”