GIL (Global Interpreter Lock)
A lock in standard CPython ensuring only one thread executes Python bytecode at a time.
🎯 Interview angle
Do not stop at 'Python can't do parallelism'. Say: on a default build the GIL applies, so use processes for CPU-bound work. Then add that the free-threaded build (PEP 703) removes it - experimental in 3.13, officially supported in 3.14 - and that removing it does not make your own data structures thread-safe.
Free-threaded build
A separate CPython build without the GIL, distributed as python3.14t. Threads can execute bytecode in parallel.
🎯 Interview angle
Three things show you have actually followed it: it is a distinct build not a flag, single-threaded code is somewhat slower because refcounting must become thread-safe, and C extensions must opt in.
Mutable default argument
Writing `def f(items=[])`. The list is created once at definition time and shared across every call.
🎯 Interview angle
A classic screening question. Use `None` as the default and build inside the body. Dataclasses raise at class-creation time instead, which is why they force `field(default_factory=list)`.
Shallow copy
A copy of a container whose elements are still references to the same nested objects.
🎯 Interview angle
`a.copy()`, `list(a)` and `{**d}` are all shallow. Mutating a nested list shows through both copies. `copy.deepcopy()` fixes it and is far more expensive - know both facts.
LEGB
Name resolution order: Local, Enclosing, Global, Built-in.
🎯 Interview angle
The consequence is what gets asked: assigning to a name anywhere in a function makes it local for the whole function, so reading it earlier raises UnboundLocalError rather than falling through to the global.
Closure
A function together with the enclosing scope it captured, keeping those variables alive after the outer call returns.
🎯 Interview angle
Behind decorators, memoisation and the late-binding loop bug where every closure sees the final loop value. The fix is a default argument or functools.partial.
Decorator
A callable that takes a function and returns a replacement, applied with @ syntax.
🎯 Interview angle
Always mention functools.wraps - without it the decorated function loses its name and docstring, breaking introspection and documentation tooling.
__slots__
A class attribute replacing the per-instance __dict__ with a fixed set of descriptors.
🎯 Interview angle
A memory optimisation for classes instantiated in the millions. The costs: no ad-hoc attributes, and multiple inheritance with slots gets awkward.
MRO / C3 linearisation
The algorithm deciding attribute lookup order across multiple inheritance.
🎯 Interview angle
It guarantees a class precedes its parents and preserves base order. When no consistent order exists Python refuses to create the class - that is the 'cannot create a consistent MRO' error.
Descriptor
An object defining __get__, __set__ or __delete__, controlling attribute access on the owning class.
🎯 Interview angle
The machinery behind property, classmethod, staticmethod and ORM fields. Knowing that property *is* a descriptor is what turns it from magic into mechanism.
Generator
A function using yield, producing values lazily and holding its state between calls.
🎯 Interview angle
The memory argument is the point: constant memory regardless of length, which is how you stream a file larger than RAM. The trade is single-consumption and no indexing.
Iterator protocol
__iter__ returning an iterator and __next__ returning the next value or raising StopIteration.
🎯 Interview angle
Distinguish iterable from iterator. A list is iterable and gives a fresh iterator each time; a generator is its own iterator and exhausts once.
Context manager
An object implementing __enter__ and __exit__, used with the `with` statement.
🎯 Interview angle
It is try/finally with a name. __exit__ runs even on exception, and returning True from it suppresses the exception - a detail worth knowing but rarely worth using.
PEP 695 generics
Python 3.12 syntax for type parameters: `class Box[T]`, `def f[T](x: T) -> T`, and the `type` alias statement.
🎯 Interview angle
Mentioning it signals you have used a recent Python. The older TypeVar form still works everywhere and is what you will meet in existing codebases.
Protocol (structural typing)
typing.Protocol - a class matches by having the right methods, without inheriting anything.
🎯 Interview angle
Static duck typing. The contrast with ABC is the answer: ABC requires explicit inheritance and enforces at instantiation; Protocol is checked by the type checker and requires nothing at runtime.
asyncio event loop
The single-threaded scheduler running coroutines, resuming each when the thing it awaited is ready.
🎯 Interview angle
Concurrency, not parallelism - one thread, one core. The killer detail: one blocking call inside a coroutine stalls every other task on the loop.
Coroutine
A function defined with async def. Calling it returns a coroutine object; nothing runs until it is awaited or scheduled.
🎯 Interview angle
The common bug is forgetting to await, which produces a 'coroutine was never awaited' warning and silently does nothing.