Episode Details
Back to Episodes
#499: So many questions??
Description
- PEP 824 brings ?? and ??= to Python for None handling
- Python 3.15 gets a surprise RC3, and Python 3.10 reaches end of life
- asyncio.shield
- Pyxel: the retro game engine for Python
- Extras
- Joke
About the show
Sponsored by us! Support our work through:
- Our courses at Talk Python
- Consulting from Six Feet Up
Connect with the hosts
- Michael: Mastodon / BlueSky / X / LinkedIn
- Calvin: Mastodon / BlueSky / X / LinkedIn
- Show: Mastodon / BlueSky / X
Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesday at 7am PT. Older video versions available there too.
Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it.
Michael #1: PEP 824 brings ?? and ??= to Python for None handling
PEP 824, a new draft from Marc Mueller sponsored by Guido van Rossum, proposes None-coalescing operators for Python 3.16. The ?? operator returns its left-hand side unless that value is None, and ??= assigns a fallback only when the target is None. It revives the long-deferred PEP 505 from over a decade ago, trimmed to just these two operators, with None-aware access split off into PEP 823. The goal is replacing verbose is None checks with something closer to or, but keyed on None instead of truthiness.
- Every Python codebase has piles of if x is None fallback code, and this is the first serious move in ten years to give it real syntax.
- user.age ?? "unknown" is like or but only falls back on None, so 0, "", and [] pass through instead of getting clobbered
- user.name ??= "unknown" replaces the two-line check-then-assign pattern, with left-side subexpressions evaluated and cached exactly once
- Precedence sits between or and conditional expressi