DistillPrep
Python
GenAI
Coming Soon
S
ML System Design
N
NLP
M
Machine Learning
D
Deep Learning
Q
DB & SQL
T
DS & Statistics
O
MLOps
C
Cloud (ML-focused)
Blog
Learn
Practice
Test
Live Engine
Select Topic
Introduction
(12)
Environment Setup
(15)
Datatypes And Keywords
(15)
Type Conversion
(17)
Operators And Expressions
(18)
Control Flow
(18)
Loops
(19)
Linear Data Structures
(20)
Non Linear Data Structures
(20)
Functions
(19)
*args & **kwargs
(18)
Lambda And Comprehensions
(19)
Closures And Decorators
(18)
Iterators And Generators
(18)
Classes And Objects
(18)
OOP Advanced
(20)
Exception Handling
(18)
File Management
(18)
Date And Time
(18)
Regular Expressions
(18)
Multithreading And Multiprocessing
(15)
Advanced Semantics
(15)
Design Patterns
(15)
easy
Classes And Objects
A teammate says "
__init__
is the constructor — it creates the object." What is the precise thing they are wrong about?
A
__init__
is not called automatically — you must invoke it explicitly after creating an instance
B
__init__
does not create the object —
__new__
allocates and returns it first; by the time
__init__
runs,
self
already exists in memory
C
__init__
is optional — Python auto-populates attributes with
None
when it is absent
D
__init__
runs once per class definition, not once per instance
Previous
Back
Next