Back to all roles

Python Developer Interview Questions

Core Overview

Practice Python Developer interview questions covering Python language mechanics, the object model, concurrency and asyncio, APIs and web frameworks, testing and typing, packaging, performance, debugging, and production security.

Reviewed using official technical documentation.
Resume Preparation

Preparing for Python Developer interviews?

Make sure your resume is positioned for the same role. Check your resume against the job description and identify gaps before you apply.

Check My ResumeFree to get started

Ready to test your knowledge?

Launch a focused practice session to review questions without distraction.

|
beginnerPython Core Mechanics & Object Model

What is the difference between mutable and immutable objects in Python, and how does mutability affect variable assignment and function arguments?

beginnerPython Core Mechanics & Object Model

What is the difference between is and == in Python, and why should is not be used for general value comparisons?

intermediatePython Core Mechanics & Object Model

What is the difference between assignment, shallow copy, and deep copy in Python, and when can shallow copying introduce subtle bugs?

intermediatePython Core Mechanics & Object Model

What are Python dunder (special) methods, how do they underpin Python's data model protocols, and why should they rarely be invoked directly?

intermediatePython Core Mechanics & Object Model

How do generators and lazy evaluation work in Python, what memory and architectural benefits do they offer, and what are their operational trade-offs?

Resume Positioning

Getting ready for the interview?

Your interview prep and your resume should tell the same story. See how well your resume matches the role you're targeting.

advancedPython Core Mechanics & Object Model

In a multi-worker web service, a module-level dictionary DEFAULT_RULES = {"discounts": [], "taxes": {"enabled": True}} is assigned as rules = DEFAULT_RULES in a request handler and appended to. This causes customer discount data to leak across unrelated requests within the same worker. How do you diagnose, remediate, and architect defenses against this shared-state mutation?

beginnerControl Flow, Concurrency & AsyncIO

What is the difference between an iterable and an iterator in Python, and why does repeated iteration behave differently between them?

beginnerControl Flow, Concurrency & AsyncIO

What is a decorator in Python, how does the @ syntax work conceptually, and why is functools.wraps important when writing wrappers?

intermediateControl Flow, Concurrency & AsyncIO

When should you choose threading versus multiprocessing in Python, how does the Global Interpreter Lock (GIL) influence that choice, and why is threading still valuable?

intermediateControl Flow, Concurrency & AsyncIO

How does Python asyncio event loop work, what does the await expression actually do at runtime, and why does async not mean parallel?

intermediateControl Flow, Concurrency & AsyncIO

What happens when synchronous blocking code executes inside an asyncio event loop, and what strategies should you use to offload it?

advancedControl Flow, Concurrency & AsyncIO

In an async web service handling high-concurrency API traffic, a new endpoint generates PDF reports using a synchronous CPU-heavy function build_pdf(data) that takes 1–3 seconds. After deployment, aggregate CPU is only 25% on a 4-core machine, but latency spikes catastrophically across all unrelated lightweight endpoints, and event-loop-lag telemetry surges while database latency remains healthy. How do you diagnose event-loop starvation, stabilize production, and architect a robust long-term solution?

beginnerAPIs, Web Frameworks & Data Serialization

How should a Python developer approach HTTP methods and status codes when designing RESTful APIs, and what common misconceptions should be avoided?

beginnerAPIs, Web Frameworks & Data Serialization

How does JSON serialization differ from working with native Python types, and how should complex types like datetime, Decimal, and sets be serialized?

intermediateAPIs, Web Frameworks & Data Serialization

What is the distinction between API input validation and domain business validation in Python services, and why should domain logic not reside inside request schemas?

intermediateAPIs, Web Frameworks & Data Serialization

How do request lifecycles and dependency injection patterns operate across Python web frameworks, and how should request-scoped resource lifecycles (like database sessions) be managed?

intermediateAPIs, Web Frameworks & Data Serialization

When should a Python API route handler be defined as synchronous versus asynchronous, and what pitfalls arise when mixing sync and async code across the call stack?

advancedAPIs, Web Frameworks & Data Serialization

After a release, GET /api/v1/orders/{order_id} latency surges from 100ms to 900ms and payload size jumps from 30KB to 1.8MB because all historical order events are eagerly loaded and serialized, though clients display only the 10 most recent. Database queries take only 70ms, but CPU and worker memory spike. How do you diagnose and resolve this serialization bottleneck?

beginnerTesting, Tooling, Typing & Packaging

What is the architectural difference between unit tests and integration tests in Python, and how should developers balance isolation against realism?

beginnerTesting, Tooling, Typing & Packaging

Why do Python projects require virtual environments, how does venv isolate packages, and what distinguishes an environment from a container or lockfile?

intermediateTesting, Tooling, Typing & Packaging

When should test doubles (mocks, stubs, fakes) be used in Python test suites, and how does over-mocking introduce testing hazards and false confidence?

intermediateTesting, Tooling, Typing & Packaging

How does Python static type hinting work with tools like mypy, what guarantees does it provide, and how does it differ from statically typed languages?

intermediateTesting, Tooling, Typing & Packaging

What role does pyproject.toml play in modern Python packaging, and how do dependency declarations differ from lockfiles and resolved build artifacts?

advancedTesting, Tooling, Typing & Packaging

A stable Python service with floating dependency some-http-library >= 2.0 starts failing intermittently in production after a fresh CI build without any code changes. Local dev environments and tests from yesterday passed, but the new build pulled a breaking transitive dependency with stricter timeouts. How do you diagnose dependency drift, stabilize production, and establish deterministic reproducibility?

beginnerProduction Python, Performance & Security

What are good practices for logging and exception handling in production Python applications?

beginnerProduction Python, Performance & Security

Why should Python developers measure and profile application performance before optimizing code?

intermediateProduction Python, Performance & Security

How does memory management work in CPython, and what common patterns cause persistent memory growth in long-running services?

intermediateProduction Python, Performance & Security

How would you systematically profile a slow or memory-heavy Python service to distinguish CPU, latency, and memory bottlenecks?

intermediateProduction Python, Performance & Security

Which Python features and standard library modules pose serious security risks when handling untrusted user input, and how should developers remediate them?

advancedProduction Python, Performance & Security

In a long-running Python API, worker RSS climbs from 400MB to >2.5GB over several hours, triggering container OOM kills and increasing p95 latency. A module-level dict caches parsed report objects keyed by customer ID and query params without an eviction limit. gc.collect() reclaims almost nothing. How do you diagnose, stabilize, and redesign the service?

Related Interview Questions

Explore complementary technical interview questions and preparation guides.

Want to tailor your resume for Python Developer roles?

Connect your interview preparation with actionable resume optimization and application tracking.

Primary

Optimize Your Resume

Compare your resume with the role you're targeting and identify areas to strengthen.

Check My Resume

Track Your Applications

Keep applications, interview stages, follow-ups, and notes organized in one place.

Open Job Tracker

View a Python Resume Example

Explore an ATS-friendly, high-impact resume blueprint tailored for Python Developer candidates.

View Resume Example