← Back to HomePython Interview Questions — What Senior Engineers Need to Know
Python interviews for senior roles focus on internals, not syntax. Expect deep questions about the GIL and its implications for concurrency, how CPython manages memory with reference counting and garbage collection, and the descriptor protocol that powers properties and classmethods.
These 28 questions target the gaps that separate mid-level Python developers from senior ones: metaclasses, import machinery, async/await internals, and the subtle differences between generators and coroutines. If you can explain these concepts to an interviewer, you’re demonstrating genuine depth.
All 28 Questions
GIL — What It Is and What It ProtectsWhat is Python's GIL, what does it protect, and what are its limitations?ThreadPoolExecutor & ProcessPoolExecutorWhat is the difference between ThreadPoolExecutor and ProcessPoolExecutor?Decorators — Under the HoodHow do decorators work under the hood in Python?Generators & yieldHow do generators and the yield keyword work in Python?Context ManagersWhat are context managers and how do you implement one?LEGB RuleWhat is the LEGB rule in Python's scope resolution?MRO, super(), Diamond ProblemExplain Python's MRO, how super() works, and the diamond problem.@property — Getter, Setter, DeleterHow does @property work as a getter, setter, and deleter?__slots__What are __slots__ and why would you use them?@classmethod vs @staticmethod vs @propertyWhat is the difference between @classmethod, @staticmethod, and @property?is vs ==What is the difference between 'is' and '==' in Python?Mutable Default ArgumentsWhy are mutable default arguments dangerous in Python?deepcopy vs Shallow CopyWhat is the difference between deepcopy and shallow copy?__new__ vs __init__What is the difference between __new__ and __init__?Memory Management — GC, Ref CountingHow does Python manage memory with garbage collection and reference counting?Decorator FactoryWhat is a decorator factory and when would you use one?__getattr__ vs __getattribute__What is the difference between __getattr__ and __getattribute__?functools.partialWhat is functools.partial and when would you use it?DefaultDict, OrderedDictWhat are defaultdict and OrderedDict and when would you use them?Duck TypingWhat is duck typing in Python?Monkey PatchingWhat is monkey patching and what are the risks?MixinsWhat are mixins and how do they differ from regular inheritance?Profiling — cProfileHow do you profile Python code with cProfile?itertoolsWhat are the most useful itertools functions and when do you use them?Pytest — Fixtures, Mocking, PatchingHow do pytest fixtures, mocking, and patching work?Code Coverage / Static AnalysisWhat are code coverage and static analysis tools and why are they useful?Package Management — Poetry, PyPI, virtualenvHow do Poetry, PyPI, and virtualenv relate in Python package management?Python Modules, Packages, __init__.pyWhat is the difference between modules and packages? What does __init__.py do? How to Prepare
Focus on understanding concepts deeply enough to explain them in your own words. For each topic, practice articulating the trade-offs and real-world applications — interviewers care about practical judgment, not textbook definitions.
Related Topics
Test Your Knowledge
Take a free AI-graded assessment across multiple domains. No signup required.
Start Free Assessment