Code Room
Code reviewMedium
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.
Learn the concepts
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 outRun or narrate your approach, then ask the coach.