Python 3.8 Release History
Python 3.8 (released October 14, 2019) introduced syntax improvements that made Python code more concise and expressive, along with runtime and standard library enhancements.
Assignment Expressions (The Walrus Operator :=)
The most notable feature — PEP 572, also known as the walrus operator.
It allows assigning and using a value in one expression:
import re
if match := re.search(r'fox', "The quick brown fox"):
print(match.group(0))
- Avoids duplicate computations
- Makes loops and conditions cleaner
- Commonly used in
whileloops and comprehensions ([Python documentation][1])
while (line := file.readline()) != "":
print(line)
Positional-Only Parameters (/)
PEP 570 introduced:
def power(x, y, /, mod=None):
return x ** y
- Arguments before
/are positional-only - Cannot be passed as keywords
- Helps design stable APIs ([Python documentation][1])
f-string Debugging
New syntax for quick debugging:
value = 42
print(f"{value=}")
- Prints both variable name and value
- Useful for debugging and logging
Standard Library Improvements
math.prod(),math.isqrt(),math.comb(),math.perm()importlib.metadatamodulemultiprocessing.shared_memory([Python documentation][2])
Performance Improvements
- Faster CPython internals
- Improved memory handling
- Early groundwork for faster calling conventions
Deprecations
- Ongoing removal of legacy APIs
- Preparation for future standard library cleanup
Subversions log
- 3.8.19 (Mar 2024) — final security updates
- 3.8.10 (May 2021) — last bugfix release
- 3.8.3 (May 2020) — asyncio and memory fixes
- 3.8.0 (Oct 2019) — initial release