The questions that actually separate candidates
- Mutable default arguments. Why does `def f(x, acc=[])` accumulate between calls? The default is evaluated once at definition time, not per call. The fix is `None` plus a check inside.
- `is` versus `==`. Identity against equality, and why small integers and short strings seem to break the rule (interning).
- The GIL. What it actually prevents, why threads still help for I/O-bound work, and why you reach for processes for CPU-bound work.
- Generators versus lists. Lazy evaluation, memory profile, and when a generator is the wrong choice (you need to iterate twice).
- Decorators. Write one that times a function. Expect a follow-up about `functools.wraps` and why it matters.
- Shallow versus deep copy, and what `copy.copy` does to a nested structure.
Data structure questions
- How is a dict implemented, and what makes a key hashable? Expect to be asked why a list cannot be one.
- When would you use a `set` over a `list`? Membership testing is O(1) against O(n), and this comes up in practical problems constantly.
- What does `collections.defaultdict` save you, and when does it surprise you by creating entries you did not intend?
- List comprehension versus `map`/`filter` - mostly a readability answer, and saying so is fine.
Practical and idiom questions
- What does a context manager do, and write one with `contextlib.contextmanager`.
- `*args` and `**kwargs` - and unpacking in a call versus collecting in a signature.
- How do you handle exceptions you do not expect? The expected answer involves catching narrowly and not swallowing.
- What is the difference between a module-level variable and a class attribute shared across instances? Mutating a class-level list is a classic bug.
- How would you profile a slow Python function? `cProfile` first, measure before optimising.
If the role is data or backend
Data roles push into pandas - vectorised operations versus `apply`, chained indexing and the `SettingWithCopyWarning`, memory on large frames. Backend roles push into async: what `async`/`await` actually do, why a blocking call inside a coroutine stalls the loop, and how that interacts with the GIL. The algorithmic half is the same for both and is covered in the 15 LeetCode patterns.
How deep it goes by level
- Junior: the fundamentals above, explained clearly. Nobody expects production scars yet, and honesty about what you have not done reads better than bluffing.
- Mid-level: the same ground, plus a script that became a service. Expect follow-ups asking why you made a particular choice rather than whether you know the syntax.
- Senior: writing a package others depend on, typing with mypy, and knowing when Python is the wrong tool for the job. At this level the language questions get shorter and the judgement questions get longer.
Whatever the level, the reliable way to prepare is to say your answers out loud rather than reading them. Most of what candidates lose in a Python interview is lost in the gap between knowing something and explaining it under observation - the method is in how to use AI for interview prep.
Where CoPilot Interview fits
Disclosure: we build an interview assistant, so treat this as a disclosed pitch. CoPilot Interview is a native Windows and macOS app that puts suggested answers on your own screen in about two seconds, across coding, system design and behavioral rounds, with a permanent free tier that needs no credit card.
Frequently asked questions
What are the most common Python interview questions?
Mutable default arguments, `is` versus `==`, the GIL and its effect on threads, generators versus lists, and writing a decorator. These recur because each one separates people who write Python regularly from people who have only read about it.
Why are mutable default arguments a problem in Python?
The default value is evaluated once when the function is defined, not on each call, so a default list or dict persists and accumulates between calls. The standard fix is to default to `None` and create the container inside the function body.
What does the GIL mean for Python interviews?
You should be able to say that it prevents multiple threads executing Python bytecode simultaneously, that threads still help for I/O-bound work because the lock is released during I/O, and that CPU-bound work needs multiple processes instead.
How deep do Python interviews go on internals?
Usually to the level of observable behaviour rather than implementation. You need to explain what a dict requires of its keys and why, but you are rarely asked about the hash table internals themselves.
Walk into the round with a second pair of eyes
CoPilot Interview is a native Windows and macOS app that puts suggested answers on your own screen in about two seconds, across coding, system design and behavioral rounds. The free tier is permanent: 15 minutes a day, no credit card.
Try it free