DEV Community

AissenceAI
AissenceAI

Posted on

40 Python Interview Questions for 2026 — How Many Can You Answer?

🐍 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)

  1. Mutable vs immutable types — name three of each.
  2. List vs tuple vs set vs dict — when each?
  3. List comprehension vs generator expression — memory difference.
  4. is vs ==.
  5. Default mutable argument trap — give an example.
  6. Decorators — write one that times function execution.
  7. Context managers — class-based vs @contextmanager.
  8. Multiple inheritance and MRO.
  9. __slots__ — what does it save?
  10. Walrus operator — give two practical uses.

Section 2 — Typing (8)

  1. PEP 695 syntax for generic functions and classes.
  2. TypeVar vs ParamSpec vs TypeVarTuple.
  3. Protocols vs ABCs — when each?
  4. Self type — example use.
  5. TypedDict — total vs not-total.
  6. Literal types and Final.
  7. NewType — when worth the boilerplate?
  8. Strict mypy vs pyright in CI.

Section 3 — Async (8)

  1. Walk through how the asyncio event loop works.
  2. asyncio.gather vs asyncio.TaskGroup (3.11+).
  3. Cancellation patterns in modern asyncio.
  4. asyncio.timeout (3.11+) vs older wait_for.
  5. Async generators — gotchas with cleanup.
  6. Mixing threads and asyncio safely.
  7. anyio — what does it solve?
  8. Free-threaded Python (3.13 PEP 703) — what changes for asyncio?

Section 4 — Performance (8)

  1. CPython GIL — what does PEP 703 free-threaded mode mean for it?
  2. When does multiprocessing beat threading?
  3. Memory profiling — what tools and what do you look for?
  4. Slow Python loop — three ways to fix.
  5. NumPy vectorization — when does it not help?
  6. C extensions vs pybind11 vs Rust + PyO3.
  7. Faster CPython project (PEP 659+) — what changed in 3.11/3.12/3.13?
  8. Cython — when is it worth the build complexity?

Section 5 — Modern features and stdlib (6)

  1. match statement — pattern types.
  2. dataclass vs pydantic — when each?
  3. pathlib vs os.path — fully migrate?
  4. Exception groups (PEP 654) — example.
  5. tomllib — replace tomli and toml?
  6. functools.cache vs lru_cache vs cached_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

  1. Saying "GIL is gone" without nuance (3.13 makes it optional, not gone).
  2. Mixing sync and async without to_thread.
  3. Forgetting __slots__ invalidates dict-based duck typing.
  4. Confusing Sequence with list in type hints.
  5. 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)