Python developer interview: questions and preparation

What is asked in a Python interview, how to answer about GIL, asyncio and typing, and how to rehearse a conversation with an AI trainer.

8 min read
Python developer interview: questions and preparation

A Python interview tests not a list of libraries, but an understanding of how the language works under the hood. A candidate who knows the syntax but cannot explain why their code slows down on one hundred thousand records loses to someone who understands the execution model.

Python Developer Interview
Python interviews value understanding of internals, not a list of frameworks.

What the interview consists of

StageWhat is assessed
Screeningexperience, stack, salary expectations
Language theoryGIL, memory, typing, iterators
Live codinghow you write and reason aloud
Architecture / systemshow you design a service, database, queues

Seven topics that are almost always asked

1. GIL — what it is and why it matters

The Global Interpreter Lock prevents multiple threads from executing bytecode at the same time. The practical takeaway: threads are useful for I/O, while CPU-bound workloads require processes or offloading to a separate service. An answer without this takeaway is considered superficial.

2. Threads, processes, and asyncio

They expect not definitions but tool selection for the task: thousands of concurrent network requests — asyncio; heavy computations — multiprocessing; blocking libraries — a thread pool. The ability to explain the choice is the main thing.

3. Typing and mypy

Type annotations do not affect runtime but catch errors during checking. They often ask about `Optional`, `Union`, `Protocol`, and generics: why they are needed and how you use them in a project.

4. Mutable objects and pitfalls

The classic: a mutable default argument (`def f(x, y=[])`), copying by reference versus `deepcopy`, hashability of dictionary keys. Here they check whether you have caught such bugs in real code.

5. Iterators and generators

The difference between a list and a generator, lazy evaluation, `yield`, why `itertools` is needed. Usually they give a task: process a large file without loading it into memory.

6. Framework and DB

For your stack: Django ORM vs raw SQL, N+1 queries, transactions, indexes. For FastAPI — dependencies, Pydantic validation, asynchronous endpoints.

7. Testing and deployment

pytest, fixtures, mocks, coverage. Docker, migrations, CI. They check whether you bring code to production, not just to “works locally”.

Preparation for a Python Technical Interview
Answering out loud reveals gaps that are not visible when reading theory.

How to answer a technical question

The structure works: claim → justification → example → limitation.

«For this task I would use asyncio. The reason is that the workload is network-bound, not compute-bound, and threads here would only add context switches. In a previous project, this is how we removed blocking when calling an external API. Limitation: if there is a synchronous library inside, it will block the event loop — it will have to be moved to an executor».

The last sentence is what distinguishes a practitioner: he knows where his solution breaks.

Frequently asked questions

How much time does it take to prepare for a Python interview?

A week of 30–40 minutes a day if you have practice: work through the seven topics above, say the answers out loud, and go through one full dialogue once. If some topic (for example, asyncio) is unclear to you, cover it first; otherwise, the answer structure won't save you.

Do they ask about algorithms and data structures?

Yes, but in different proportions. Product teams more often give practical tasks (optimize a query, break down a pipeline), large tech companies — classic tasks on arrays, strings, hash tables. It is worth clarifying the format with the recruiter.

What should I do if I don't know the answer?

Say it directly and show your thought process: what it is similar to, how you would check. The interviewer almost always distinguishes “I don’t know, but I think” from making things up, and the latter is a direct minus.

Is it necessary to know Django and FastAPI at the same time?

No. They usually ask about the stack specified in the vacancy. But understanding the principles (routing, dependencies, working with a DB) transfers between frameworks, and this is valued higher than knowledge of a specific API.

How should I answer about salary expectations?

As a range, not a single number, based on the market. A detailed breakdown is in the article salary negotiations.

How to practice an interview with AI?

Describe the situation in one phrase — «Python developer interview, FastAPI, four years of experience» — and go through the dialogue in simulator. The coach will ask questions about your role and review your answers after the conversation.

What's next

Go through the seven topics and mark those where your answer doesn't add up. Then run the full dialogue: open HintMeTalk AI, mode “Coach”, describe the vacancy in one phrase. After the review, you can see which answers are weak — usually two or three out of ten.

General preparation for any interview — in the article interview preparation. The frontend interview is covered separately.

Practise this skill in HintMeTalk AI

Open the app

Sources