Code Room
Code reviewMediumcr-g297
Subject Repeated workLevel Mid–Senior~18 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Python function that resolves and applies a discount rule for each item in a large cart batch. `load_rule` is an expensive parse of a rule blob.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewpython
def price_items(items):    out = []    for item in items:        rule = load_rule(item.rule_id)   # expensive: parses + compiles the rule        out.append(rule.apply(item.price))    return out
Run or narrate your approach, then ask the coach.