🐍 40 Python Interview Questions for 2026 — How Many Can You Answer? 🎯
Python remains the #1 backend / data / ML language in 2026. The interview bar moved up: now you're expected to know typing (PEP 695 generics), async patterns, and the Python 3.13 free-threaded mode.
Here are 40 questions across five themes.
A 2026 Python interview spans language fundamentals, typing, async, performance, and modern features (3.12+). Most candidates over-prep syntax and under-prep async + typing.
Section 1 — Language fundamentals (10)
- Mutable vs immutable types — name three of each.
- List vs tuple vs set vs dict — when each?
- List comprehension vs generator expression — memory difference.
-
isvs==. - Default mutable argument trap — give an example.
- Decorators — write one that times function execution.
- Context managers — class-based vs
@contextmanager. - Multiple inheritance and MRO.
-
__slots__— what does it save? - Walrus operator — give two practical uses.
Section 2 — Typing (8)
- PEP 695 syntax for generic functions and classes.
-
TypeVarvsParamSpecvsTypeVarTuple. - Protocols vs ABCs — when each?
-
Selftype — example use. -
TypedDict— total vs not-total. -
Literaltypes andFinal. -
NewType— when worth the boilerplate? - Strict mypy vs pyright in CI.
Section 3 — Async (8)
- Walk through how the asyncio event loop works.
-
asyncio.gathervsasyncio.TaskGroup(3.11+). - Cancellation patterns in modern asyncio.
-
asyncio.timeout(3.11+) vs olderwait_for. - Async generators — gotchas with cleanup.
- Mixing threads and asyncio safely.
-
anyio— what does it solve? - Free-threaded Python (3.13 PEP 703) — what changes for asyncio?
Section 4 — Performance (8)
- CPython GIL — what does PEP 703 free-threaded mode mean for it?
- When does multiprocessing beat threading?
- Memory profiling — what tools and what do you look for?
- Slow Python loop — three ways to fix.
- NumPy vectorization — when does it not help?
- C extensions vs pybind11 vs Rust + PyO3.
- Faster CPython project (PEP 659+) — what changed in 3.11/3.12/3.13?
- Cython — when is it worth the build complexity?
Section 5 — Modern features and stdlib (6)
-
matchstatement — pattern types. -
dataclassvspydantic— when each? -
pathlibvsos.path— fully migrate? - Exception groups (PEP 654) — example.
-
tomllib— replacetomliandtoml? -
functools.cachevslru_cachevscached_property.
How to drill
- One section per day.
- Re-implement decorators / context managers / typing examples in a REPL.
- Use the coding copilot to sanity-check your answers against current best practice.
Common gotchas
- Saying "GIL is gone" without nuance (3.13 makes it optional, not gone).
- Mixing sync and async without
to_thread. - Forgetting
__slots__invalidates dict-based duck typing. - Confusing
Sequencewithlistin type hints. - Default mutable arguments in production code.
Mock plan
Use practice mode for timed reps. The AI scores accuracy on language details and modernness.
Get started
Free forever plan: aissence.ai/auth/signup.
Top comments (0)