Assignment expressions, explained with the examples that actually help.
Aditya Challa1 min read
The walrus operator := assigns a value to a variable as part of a larger expression. It was added in Python 3.8 through PEP 572 and is officially called an assignment expression.
Without it, you would call len() twice or add a separate line.
PEP 572 and PEP 8 favour readability. Do not use := where a plain assignment statement is clearer, and note that an unparenthesised := at the top level of an expression statement is a syntax error.
Related: /blog/what-is-the-difference-between-is-and-equals-in-python
Related: /blog/are-python-dictionaries-ordered
Related: /blog/what-does-if-name-main-do-in-python
Lab evidence
Facts in this draft were checked on 12 Oct 2026 against the primary sources listed in the body (official docs, release schedules or Google/YouTube help pages). No benchmarks or timings were run, so the post makes no performance or measurement claims; dates are quoted as published by the maintainers, and any estimate is labelled as such.
Explore the product
Freelancers and devs who want to turn coding skills into paid site builds
Generators, lazily: what yield actually does to a function.
Summary12 Oct 20261 min read
Use a timezone-aware datetime; utcnow() is deprecated since Python 3.12.
Summary12 Oct 20261 min read
The modern answer is pathlib, but the right choice depends on what you do next.
Summary12 Oct 20261 min read