Quiz · 3 questions
🏗️ OOP — Python's Class Mechanics
class / dunder / dataclass / Protocol / ABC
Level 0Curious
0 XP0/93 lessons0/23 achievements
0/100 XP to next level100 XP to go0% complete
Quiz
01What's wrong with
class Cart: items = [] (with items defined at class level)?Hint
Where exactly does the
[] get evaluated?02If you override
__eq__ on a class but don't override __hash__, what happens?Hint
What's the contract between
== and hash()?03When should you use
Protocol instead of ABC?Hint
Inheritance required (ABC) vs shape match (Protocol)?
Comments 0
🔔 Reply notifications (sign in)Sign in — Please sign in to comment.
No comments yet — be the first.