Image: Python Software Foundation — Python logo (official logo, via Wikimedia Commons)
?., ?[ ] and ?? to handle None safely instead of crashing — but both are still drafts, not accepted, so you cannot use them in any released Python yet.📌 KEY HIGHLIGHTS
- PEP 823 proposes
?.(None-aware attribute access) and?[ ](None-aware indexing) for Python 3.16 — a chain returnsNoneinstead of raising an error when one link isNone. - PEP 824 proposes
??(None-coalescing) and??=(None-coalescing assignment) —age ?? "unknown"means "use the age, or"unknown"if it isNone". - Both PEPs were written by Marc Mueller, sponsored by Guido van Rossum, created on 20 September 2026 and updated on 1 November 2026. Both are still Draft status and are now before Python's Steering Council.
- The idea is over ten years old: PEP 505 proposed the same operators in 2015 and was deferred. JavaScript, TypeScript, C#, Swift and Kotlin already have them.
- You cannot try the real thing yet — but there is an interactive demo and a reference implementation to play with.
What are Python 3.16's none-aware operators?
Every Python developer knows the crash: you fetch a user from an API, dig three levels into the response, and one level is None. Python raises AttributeError: 'NoneType' object has no attribute ... and your program stops. The usual fix is a ladder of is not None checks, or the and trick, or a helper library. PEP 823 and PEP 824, published together on 20 September 2026 and aimed at Python 3.16, propose giving the language four small operators to handle this directly.
The proposals are drafts, not decisions. Nothing here is in Python 3.15, which shipped on 9 October 2026 — our Python 3.15 upgrade guide covers what that release actually added. The first Python 3.16 alpha arrived in October 2026, within days of 3.15.0 final, but the operators are not in it: they can only land if the Steering Council accepts the PEPs. On Python's usual annual schedule, a 3.16 final would arrive around October 2027.
How ?. and ?[ ] work (PEP 823)
The ?. operator is a version of the dot that gives up gracefully. If the value on its left is None, the whole expression becomes None instead of raising AttributeError. The ?[ ] operator does the same for indexing. The PEP's own example turns seven lines into one:
def get_customer_name(data):
return data.customer?.user?.name.lower()
Today, that same function needs three nested is not None checks. With ?., if data.customer is None, the rest of the chain is simply skipped and the function returns None. The same idea works on JSON-style data, where ?[ ] does the indexing:
def get_customer_name(data):
return data.get("customer")?["user"]?["name"].lower()
Two details matter. First, the operators only handle optional values — values that exist but may be None. They do not handle missing keys or attributes: if a dictionary simply has no "customer" key, ?[ ] will not save you, and you still need dict.get(). Second, short-circuiting stops at the first None but breaks when another operator appears: a?.b.c or "Hello" gives "Hello" when a is None, while 2 in a?.b.c still raises TypeError, because in cannot test membership of None.
How ?? and ??= work (PEP 824)
The ?? operator is Python's missing "or, but only for None". It evaluates the left side once; if the result is not None, that is the answer, otherwise the right side is evaluated and returned:
age = user.age ?? "unknown" # Same as: age = user.age if user.age is not None else "unknown" # ...but user.age is evaluated only once.
The difference from or is the whole point. or treats 0, "" and [] as missing too; ?? treats only None as missing. A score of 0 or an empty name stays 0 or "" with ??, while or would silently replace them with the fallback. Chains work left to right — a ?? b ?? c ?? d returns the first value that is not None — and ?? binds less tightly than or and and, so the PEPs recommend parentheses when mixing them.
The companion operator ??= assigns only when the target is None, which finally gives Python a one-line pattern for mutable defaults:
def add_default_user(users=None):
users ??= []
users.append(create_default_user())
return users
| Operator | PEP | What it does | Today's equivalent |
|---|---|---|---|
?. | 823 | Attribute access that returns None instead of raising AttributeError | x.b if x is not None else None |
?[ ] | 823 | Indexing that returns None instead of raising TypeError | x[k] if x is not None else None |
?? | 824 | Returns the left side unless it is None, then the right side | a if a is not None else b |
??= | 824 | Assigns the right side only if the target is None | if a is None: a = b |
Image: Python Software Foundation — Python logo and wordmark (via Wikimedia Commons)
Why it matters for Indian developers
Python is the first language for a huge share of Indian developers — Django backends, data work, automation and the AI tooling wave all run on it. None errors are the most common runtime crash in exactly the code Indian teams write most: API responses, database rows and JSON payloads where a field is sometimes absent. If the operators land, a large class of defensive boilerplate disappears, and the code that remains says what it means: "this may be missing, and here is what to do about it."
There is a practical angle too. Indian teams upgrading to Python 3.15 — Django 6.1.3 already gates on it — are the audience most likely to adopt 3.16 early, and the operators would arrive alongside the rest of that release. And for students, the change is a genuine teaching moment: ?. and ?? are already familiar from JavaScript and TypeScript, so Python catching up removes one more "why can't Python do this?" from the classroom.
The catch: what the critics say
The proposals are not sailing through. The liveliest objection, raised repeatedly in the python.org discussion, is that ?. moves a None instead of removing it — and a moved None can do quiet damage. The PEP's own critics give the example articles[:user?.plan?.article_limit]: if user is None, the slice becomes articles[:None], which in Python means every article, including ones the visitor should not see. Without ?., the code would have crashed loudly on day one and the bug would have been found.
Other objections are about the language itself. Python's guiding idea is that "explicit is better than implicit", and a question mark hides a decision about missing data. Teachers worry about the cost of explaining two more operators, and about precedence surprises when ?? meets and and or. The authors answer that the operators are opt-in, that each PEP can be accepted independently, and that the reference implementation plus the public demo let anyone test the behaviour before judging it. One practical worry is already settled: IPython's ? and ?? help shortcuts were tested against the new operators and keep working, because they appear in different positions.
Should you care?
None handling than the operators themselves. Do not write ?. in production code today — no released Python accepts it, and the PEPs may still change or be rejected. Try the demo, follow the Steering Council decision, and keep your is not None checks until 3.16 says otherwise.FAQs
What does ?. mean in Python?
It is a proposed None-aware attribute access operator: user?.name returns the name if user is not None, and returns None instead of raising AttributeError if it is. It is defined in draft PEP 823 and is not part of any released Python yet.
Is Python getting a ?? operator?
Maybe. PEP 824 proposes ?? (return the left value unless it is None, otherwise the right value) and ??= (assign only when the target is None). Both PEPs are drafts under Steering Council review, so acceptance is not guaranteed.
Can I use ?. in Python 3.15 today?
No. Python 3.15, released on 9 October 2026, does not include these operators, and neither does any earlier version — the syntax raises a SyntaxError today. The earliest they could appear is Python 3.16, and only if the PEPs are accepted. You can test the behaviour in the authors' interactive demo instead.
When will Python 3.16 be released?
There is no confirmed date. The first 3.16 alpha shipped in October 2026, and on Python's usual annual schedule a final release would arrive around October 2027 — but that depends on the PEPs being accepted in time, and the schedule itself is not yet published.
Takeaway: Python may finally get the ?. and ?? operators other languages have had for years — but "may" is doing a lot of work. The PEPs are drafts, the debate is live, and the honest move is to learn the syntax now and wait for the Steering Council before writing it anywhere real. Try the interactive demo linked in the sources to see how the operators behave.
Sources
- PEP 823 – None-aware access operators (peps.python.org, primary source)
- PEP 824 – None-coalescing operators (peps.python.org, primary source)
- PEP 505 – None-aware operators, 2015 (peps.python.org)
- Interactive PEP 823 / PEP 824 demo
- PEP 823 discussion on python.org (Discourse)
- None-aware operators reopen Python's syntax and teachability fights (freenode, 5 November 2026)
- Python 3.15 Ships and Other Python News for November 2026 (Real Python, via Daily.dev)
Comments
Post a Comment