Skip to content
Sharp

Classes and Objects · interview question

What is the healthiest performance judgment around dataclass basics?

Multiple choiceMediumchapter-7-curatedpremiumclasses-and-objectsdataclass-basics
python
from dataclasses import dataclass

@dataclass
class OrderLine:
    sku: str
    quantity: int
Choose one answer
Answer and explanation

Correct answer

D. Measure before optimizing, then change the part that actually dominates cost instead of guessing from style alone.

Why

Premature optimization is usually weaker than targeted optimization backed by measurement.

Test yourself on Classes and Objects

A free test with instant, explained results. No account needed.

Start free test
All Classes and Objects questions →