← Back to videos

Mock Python Junior Interview – Sunnet

Interview timeline Click any block to jump

Interview breakdown

Interviewer verdict
Needs more practice Level: Intern / Beginner

The candidate did not yet meet the Junior bar: core Python concepts are covered only at a surface level, leading to contradictions on follow-up questions around iterators, generators, __new__ vs __init__, and interfaces. With 2–3 months of focused work on Python fundamentals before diving deeper into FastAPI, he has a clear path forward.

Candidate: Sunnat
Target role: Junior Python Backend

1st-year Software Engineering student · studied Python basics and OOP, currently learning FastAPI, no commercial experience yet

Answers accuracy 13 total
35% score
Theory
1/10 correct · 35%
Live coding
0/3 correct · 33%
Practical task
Partially solved

Overriding __new__ in a class: why type(WTF()) evaluates to int

Before running the code, the candidate predicted type WTF because he hadn't used __new__. After seeing <class 'int'>, he rightly deduced that __new__(cls) ran automatically on WTF() and returned 42, but could not explain __new__'s true role as allocator/constructor versus __init__.

Topics covered Click a topic to filter questions

Candidate strengths

  • + Calm demeanor: pauses to think before speaking and keeps dialogue moving without freezing up
  • + Baseline familiarity with core Python entities (__iter__/__next__, base object class, type())
  • + Receptive attitude toward probing questions and constructive feedback on knowledge gaps

Areas to improve

  • → Master Python's object creation lifecycle: constructor __new__(cls) vs initializer __init__(self)
  • → Clearly distinguish iterables, iterators, lazy generators (yield / generator expressions), and list comprehensions
  • → Understand CPython memory management (reference counting plus generational cyclic garbage collection)
  • → Solidify OOP fundamentals (interfaces, base vs abstract classes, metaclass type) before focusing heavily on FastAPI

Questions in this interview

13 / 13
01 ▶ 03:20
What is Python's garbage collector, and how does it know which objects are 'garbage'?
Theory Python internals, bytecode & runtime
?
Candidate's answer

Correctly contrasted Python's automatic memory management with manual allocation in C, but vaguely described garbage as 'unused cached data' without mentioning references.

Key takeaway

CPython reclaims memory primarily via immediate reference counting (refcount == 0), backed by a generational cyclic garbage collector (gc) that breaks unreachable reference cycles.

Open moment on YouTube ↗
#01
02 ▶ 06:09
What are iteration, an iterable, and an iterator in Python?
Theory Decorators, iterators, generators & context managers
?
Candidate's answer

Correctly linked element traversal to __iter__ and __next__, but confused an iterator with a user-written function and later with the for-loop construct itself.

Key takeaway

An iterable implements __iter__() to produce an iterator object; the iterator tracks traversal state, yields items via __next__(), and raises StopIteration when exhausted.

Open moment on YouTube ↗
#02
03 ▶ 14:28
Why are dunder methods called 'magic' methods in Python, and how do they differ from regular methods?
Theory OOP, classes & dunder methods
?
Candidate's answer

Identified the double-underscore (dunder) naming convention, but could not explain their behavioral difference from regular methods.

Key takeaway

Dunder methods are invoked implicitly by the Python runtime for built-in syntax and protocols (+, len(), for, with), rather than being called directly by name.

Open moment on YouTube ↗
#03
04 ▶ 16:04
Does Python have built-in iter() and next() functions, and how do you implement a custom iterable class?
Theory Decorators, iterators, generators & context managers
?
Candidate's answer

Said he hadn't encountered built-in iter() and next(), and mistakenly agreed that merely declaring empty __iter__ and __next__ methods makes a class iterable.

Key takeaway

Built-ins iter(obj) and next(it) drive the iterator protocol; __iter__ must return an iterator object and __next__ must return the next value or raise StopIteration.

Open moment on YouTube ↗
#04
05 ▶ 19:11
What is the base 'object' class, is it an object itself, and what does type(object) return?
Theory OOP, classes & dunder methods
?
Candidate's answer

Correctly noted all classes inherit from 'object', everything in Python is an object, and type() inspects an object's class, but didn't know what class 'object' itself is an instance of.

Key takeaway

In Python's object model, 'object' is the root base class and 'type' is the root metaclass: type(object) is type, while type itself subclasses object.

Open moment on YouTube ↗
#05
06 ▶ 21:43
How do you instantiate an object from a class in Python, and are there other ways?
Theory OOP, classes & dunder methods
?
Candidate's answer

Described standard instantiation by calling the class name (slightly misstating the 'class' keyword), and knew no alternative instantiation mechanisms.

Key takeaway

Besides calling MyClass(), instances can be created via @classmethod factories (e.g., datetime.fromisoformat), copy/deepcopy, deserialization, or cls.__new__(cls).

Open moment on YouTube ↗
#06
07 ▶ 23:28
What are generators in Python, and what is their core advantage over regular loops and lists?
Theory Decorators, iterators, generators & context managers
?
Candidate's answer

Equated generators with compact one-line syntax for populating lists, missing lazy evaluation and yield, and said he hadn't used the term list comprehension.

Key takeaway

Generators (functions using yield or (x for x in ...)) produce items lazily on demand in O(1) memory, unlike list comprehensions [x for x in ...] that materialize all elements in RAM.

Open moment on YouTube ↗
#07
08 ▶ 30:01
Is __init__ a constructor or an initializer, and what does the __new__ dunder method do?
Theory OOP, classes & dunder methods
?
Candidate's answer

Called __init__ the class constructor for setting initial attributes and admitted he had never encountered __new__.

Key takeaway

__new__(cls, ...) is the actual constructor that allocates and returns the new instance, whereas __init__(self, ...) initializes attributes on an already-created object.

Open moment on YouTube ↗
#08
09 ▶ 31:59
Is defining __init__ mandatory in every Python class?
Theory OOP, classes & dunder methods
?
Candidate's answer

Correctly answered that omitting __init__ causes no error, though it is needed whenever instances require custom initial attributes.

Key takeaway

__init__ is optional: classes without custom per-instance setup inherit a no-op object.__init__() (or let @dataclass generate one automatically).

Open moment on YouTube ↗
#09
10 ▶ 33:00
What is a class interface, and how does a regular base class differ from an abstract class?
Theory OOP, classes & dunder methods
?
Candidate's answer

Defined an interface as 'shared similarities among objects' (conflating it with inherited fields even after an ATM analogy) and couldn't distinguish a concrete base class from an abstract one.

Key takeaway

An interface defines external callable operations; a concrete base class can be instantiated directly, while an abstract class (abc.ABC + @abstractmethod) cannot be instantiated until subclasses implement its abstract methods.

Open moment on YouTube ↗
#10
11 ▶ 39:05
What does 'class WTF: def __new__(cls): return 42; a = WTF(); print(type(a))' output?
Live coding OOP, classes & dunder methods
?
Candidate's answer

Noticed __new__ takes cls rather than self, but predicted a = WTF() would still produce a WTF instance and print type WTF.

Key takeaway

Calling WTF() invokes WTF.__new__(WTF) first; returning 42 makes 'a' an int (skipping WTF.__init__ entirely), so type(a) prints <class 'int'>.

Open moment on YouTube ↗
#11
12 ▶ 42:44
Why did type(a) print <class 'int'>, and is __new__ called even on normal classes that don't define it?
Live coding OOP, classes & dunder methods
?
Candidate's answer

After seeing the output, deduced that __new__ ran automatically on instantiation and returned 42, and guessed __new__ runs by default too, though he misattributed attribute initialization to it.

Key takeaway

Every instantiation calls inherited object.__new__(cls) to allocate a blank instance first; Python only invokes __init__(self, ...) if __new__ returns an instance of cls.

Open moment on YouTube ↗
#12
13 ▶ 45:08
What is the Zen of Python, and why does Python allow overriding __new__ despite 'Explicit is better than implicit'?
Live coding Algorithms, code reading & engineering practices
?
Candidate's answer

Described the Zen of Python as guiding philosophy (quoting 'Beautiful is better than ugly'), but couldn't name practical engineering use cases for __new__.

Key takeaway

__new__ serves real practical needs ('Practicality beats purity'): subclassing immutable types (int, str, tuple), implementing Singletons/object caches, and custom metaclasses.

Open moment on YouTube ↗
#13
Original video description & timecodes

A live mock interview for a Junior Python Developer position with detailed feedback at the end. The conversation begins with a brief introduction, after which the candidate answers questions on fundamental Python topics: garbage collection, iterators, generators, magic methods, object creation, __init__, __new__, classes, objects, base and abstract classes, as well as interfaces and OOP in general.

Throughout the interview, it becomes clear that not only theoretical knowledge is being assessed, but also depth of understanding, reasoning skills, the ability to handle unconventional questions, and to calmly respond to the interviewer’s clarifications. In the end, the candidate’s strengths and weaknesses are reviewed, common gaps among beginner developers are discussed, and recommendations are given on what to focus on in learning in order to perform more confidently in real interviews.

This video will be useful for those preparing for a Junior Python Developer interview, studying Python, and wanting to better understand what questions might come up, how to answer them, and which knowledge is truly important for starting a career. It’s not just interview practice, but also a great opportunity to identify your own gaps, deepen your understanding of Python fundamentals, and figure out what direction to move in next.

Timestamps:

00:00 Start
00:11 Mock interview for Junior Python Developer
01:05 Candidate self-introduction
01:42 Interview format overview
03:20 Garbage collector in Python explained simply
06:09 Iterators, iteration, and iterable objects
14:28 Why magic methods are called “magic”
16:04 Are there iter() and next() functions in Python
16:44 How to implement an iterable object
19:11 The object class, base classes, and the nature of objects
21:43 How to create an object from a class
23:28 Generators in Python: what they are
27:24 How a generator differs from a loop
30:01 __init__: constructor or initializer
31:06 __new__ in Python: what kind of magic method it is
39:05 Practical task: why type(a) became int
45:08 The Zen of Python vs “magic”
52:30 Candidate self-assessment after the interview
54:13 Feedback: weaknesses and growth areas
01:06:14 Interview verdict
01:07:51 Why beginners need mock interviews

#python #pythondeveloper #juniorpython #pythoninterview #interview #pythondeveloper #juniordeveloper #oop #programming #itcareer #interviewprep #developer #learnpython #mockinterview #pythonjunior