← Back to videos

Junior Python Developer Mock Interview: Objects, Dunder Methods, and Singleton

Interview timeline Click any block to jump

Interview breakdown

Interviewer verdict
Passed with caveats Level: Borderline Junior (strong live reasoning despite core OOP gaps)

A 50-50 borderline outcome: factual knowledge of Python's object model, dunder protocols, and core patterns was weak, but the interviewer praised the candidate's real-time self-reflection, logical reasoning, and resilience in the second half of the code task. Closing foundational OOP gaps should quickly bring him up to a confident Junior bar.

Candidate: Andrey
Target role: Junior Python Developer

~3 years building simple personal projects without deep OOP or SOLID practices, seeking his first Python developer role

Answers accuracy 12 total
38% score
Theory
1/8 correct · 38%
Live coding
1/4 correct · 38%
Practical task
Partially solved

Overriding __eq__, the NotImplemented singleton, and truthiness of [result]

In the first half, the candidate confused == with assignment =, did not know __eq__ or NotImplemented, and expected Cat() == Dog() to raise an error. Once guided through the execution yielding False, he accurately predicted and defended 'Yes' in the follow-up check on a non-empty list [result] containing False.

Topics covered Click a topic to filter questions

Candidate strengths

  • + Strong real-time reflection: tracks question context and constructs logical chains on the fly
  • + Solid grasp of *args and **kwargs packing/unpacking and argument ordering rules
  • + Accurately reasoned through the truthiness of [False] in the second part of the code task despite pushback
  • + Constructive, non-defensive attitude when catching his own mistakes

Areas to improve

  • → Study Python's object model: base class object, metaclass type, and __new__ vs __init__
  • → Learn the Singleton pattern and built-in Python singletons (None, True, False, NotImplemented)
  • → Understand __eq__ comparison dispatch and fallback delegation via returning NotImplemented
  • → Answer the exact question asked without volunteering unfamiliar terms (stack frames, descriptors, __iter__) that invite deeper probing

Questions in this interview

12 / 12
01 ▶ 04:28
Where do objects come from in Python, and what is required to create an object?
Theory OOP, classes & dunder methods
?
Candidate's answer

Correctly stated that everything in Python is an object referenced by variables, but initially conflated object creation with variable assignment before concluding via hints that a class instantiates objects.

Key takeaway

Every object in Python is an instance of a class (type) responsible for allocating and initializing that object.

Open moment on YouTube ↗
#01
02 ▶ 09:55
How does a method differ from a regular function in Python?
Theory OOP, classes & dunder methods
?
Candidate's answer

Initially reduced the difference to double underscores on dunders, then reasoned to the core distinction: methods belong to a class and implicitly receive self or cls.

Key takeaway

A method is a function defined on a class that binds to an instance on attribute access, automatically passing the instance as self.

Open moment on YouTube ↗
#02
03 ▶ 12:51
Is a class itself an object in Python, what class is it an instance of, and how is the first class bootstrapped?
Theory OOP, classes & dunder methods
?
Candidate's answer

Confirmed classes are objects and guessed CPython bootstraps the root statically in C, but misnamed the base class BaseModel (from Pydantic) instead of object and missed metaclass type.

Key takeaway

All classes inherit from object, while every class (including object and type itself) is an instance of the metaclass type, statically bootstrapped in CPython's C runtime.

Open moment on YouTube ↗
#03
04 ▶ 14:18
How many instances of a class can you create, and what is the stack in program memory?
Theory Data types, numbers & memory
?
Candidate's answer

Named LIFO for the stack but immediately defined it backwards as first-in-first-out (FIFO), claiming the stack exists to make code execute line by line.

Key takeaway

The call stack follows LIFO (Last In, First Out) to manage active function frames, while all Python objects live on the heap bounded by available memory.

Open moment on YouTube ↗
#04
05 ▶ 17:56
What are *args and **kwargs, are their names reserved keywords, and in what order must they appear?
Theory Functions, scopes & closures
?
Candidate's answer

Correctly explained that args/kwargs are naming conventions while * packs positional arguments into a tuple and ** packs keyword arguments into a dict, with *args preceding **kwargs.

Key takeaway

In function definitions *args collects extra positional arguments into a tuple and **kwargs collects keyword arguments into a dict; at call sites * and ** unpack iterables and mappings.

Open moment on YouTube ↗
#05
06 ▶ 19:51
How can you limit the number of instances a class creates, and how does __new__ differ from __init__?
Theory OOP, classes & dunder methods
?
Candidate's answer

Remembered that __new__(cls, ...) runs before __init__ and can intercept instantiation, but mistakenly thought __new__ prepares an already-existing instance rather than creating and returning it.

Key takeaway

__new__(cls, ...) allocates and returns the new instance (enabling instance caching or limits), whereas __init__(self, ...) initializes attributes on the already-created object.

Open moment on YouTube ↗
#06
07 ▶ 23:37
What is None in Python, what is its class, and can you instantiate multiple distinct None objects?
Theory Data types, numbers & memory
?
Candidate's answer

Correctly described None as representing the absence of a value (such as a function without return), but mistakenly claimed its class can be subclassed and instantiated millions of times.

Key takeaway

None is the sole instance of NoneType: calling type(None)() always returns the exact same None object, and subclassing NoneType raises TypeError.

Open moment on YouTube ↗
#07
08 ▶ 25:54
What is the Singleton pattern, which built-in singletons exist in Python, and why restrict instance count?
Theory OOP, classes & dunder methods
?
Candidate's answer

Confused Singleton with a singly linked list and could not name built-in Python singletons or real-world use cases.

Key takeaway

A Singleton guarantees at most one instance of a class; Python's built-in singletons include None, True, False, Ellipsis, and NotImplemented.

Open moment on YouTube ↗
#08
09 ▶ 32:53
What core building blocks make up a Python class, and what triggers dunder methods to run?
Live coding OOP, classes & dunder methods
?
Candidate's answer

With prompting, identified attributes and methods and correctly connected dunder execution to built-in functions and operators like len() -> __len__ and + -> __add__.

Key takeaway

Dunder methods implement Python's data-model protocols and are invoked implicitly by the runtime for operators and built-in functions.

Open moment on YouTube ↗
#09
10 ▶ 35:11
What does result = Cat() == Dog() do, what is __eq__ for, and will the snippet run without raising an error?
Live coding OOP, classes & dunder methods
?
Candidate's answer

Confused == with assignment, did not recognize __eq__ as equality comparison, and predicted a runtime error until the snippet was run and explained.

Key takeaway

In result = Cat() == Dog(), == evaluates equality by calling __eq__, and = binds the resulting bool to result.

Open moment on YouTube ↗
#10
11 ▶ 44:41
What is NotImplemented, and why did Cat() == Dog() execute both Cat.__eq__ and Dog.__eq__?
Live coding OOP, classes & dunder methods
?
Candidate's answer

Admitted he had never seen NotImplemented and could not explain why returning it from Cat.__eq__ caused Python to call Dog.__eq__.

Key takeaway

Returning the NotImplemented singleton (distinct from NotImplementedError!) signals that left.__eq__(right) does not know how to compare the types, prompting Python to try right.__eq__(left).

Open moment on YouTube ↗
#11
12 ▶ 48:22
What does if [result]: print('Yes') output when result holds False?
Live coding Control flow, loops & syntactic sugar
?
Candidate's answer

Once he confirmed result is False, stood firm that if [result]: prints 'Yes' because a list containing False has length 1 and is therefore truthy.

Key takeaway

Container truthiness in Python depends solely on length (len(x) > 0), not element truthiness: [False], [0], and [None] are all truthy.

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

A public mock interview for a Junior Python Developer position. Андрей answers questions about Python objects, classes, memory, dunder methods, __new__, __init__, None, type, and the Singleton pattern, then analyzes code that overrides __eq__. The interview concludes with detailed feedback on his reasoning skills and the Python fundamentals he should strengthen.