Home · Interview questions · Python Developer

Python Developer interview questions

Python interviews check whether you write idiomatic code and understand what the language is doing underneath, from the GIL to how generators save memory.

What interviewers look for

How the interview usually runs

  1. Recruiter call.
  2. Python coding task.
  3. Technical interview on past projects and frameworks.
  4. Behavioural round.

Stages vary by company, so ask the recruiter what to expect before you start preparing.

10 Python Developer interview questions, and how to answer them

1. What is the GIL and when does it matter?

What they want to see: Understanding concurrency limits.

How to answer: It lets one thread run Python at a time, so it hurts CPU-bound threads. Use processes for CPU work and async or threads for I/O.

2. List or generator: which and why?

What they want to see: Memory awareness.

How to answer: Generators yield lazily, so use them for large or streaming data.

3. How do decorators work?

What they want to see: Functions as objects.

How to answer: Explain wrapping a function, use functools.wraps, and give a logging or retry example.

4. Why is a mutable default argument dangerous?

What they want to see: A classic pitfall.

How to answer: It's created once at definition, so it's shared across calls. Default to None.

5. When would you use asyncio?

What they want to see: Choosing the right concurrency model.

How to answer: For many concurrent I/O waits. Warn that one blocking call stalls the event loop.

6. How do you structure tests with pytest?

What they want to see: Real testing habits.

How to answer: Mention fixtures, parametrising and mocking only at the boundaries.

7. How do you find a performance problem?

What they want to see: Measurement first.

How to answer: Use cProfile or py-spy, then fix the hot path with better data structures or NumPy.

8. Explain the difference between @staticmethod and @classmethod.

What they want to see: Language detail.

How to answer: Class methods receive the class, which suits alternative constructors. Static methods receive neither.

9. How do you manage dependencies?

What they want to see: Production habits.

How to answer: Use lock files, virtual environments and pinned versions in deployment.

10. FastAPI or Django for this project?

What they want to see: Framework judgement.

How to answer: Django for full apps with admin and ORM, FastAPI for typed async APIs. Decide from the project.

A sample answer

How do you find a performance problem?

A nightly report took 40 minutes. I profiled it with cProfile and found most of the time went on a list membership check inside a loop. Switching to a set and batching database reads took the run down to six minutes. I added a timing check to CI so we'd notice if it crept back up.

A made-up example to show the structure. Use your own experience and real numbers.

Common mistakes

Practise this out loud

Run a mock interview for a Python Developer role. Questions change every time, you answer by voice or typing, and each answer gets a score with feedback.

Frequently asked questions

What Python version should I talk about?

Use the current stable version you've worked with and mention features you've used, such as type hints and dataclasses.

Do Python interviews include algorithms?

Often yes, at easy to medium level. Knowing list, dict and set complexity helps a lot.

Related roles