← Quiz: Type Hints and Dataclasses: all 10 questions
Quiz: Type Hints and Dataclasses · Question 9 of 10
When does postinit run?
When does __post_init__ run?
- A.Before init
- B.At the end of the generated init
- C.Only when the object is printed
- D.When the object is deleted
Answer & explanation
Correct answer: At the end of the generated init
It is the place for validation and computed fields.
Can you get the rest right without peeking?
Take the timed Quiz: Type Hints and Dataclasses quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →