Code Room
Code reviewHardcr-g341
Subject Data bugsLevel Senior–Staff~20 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Python that enforces unique display names by lowercasing and checking against the set of claimed keys.

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 make_key(name):    return name.strip().lower() def claim_name(name, taken):    key = make_key(name)    if key in taken:        raise ValueError('name taken')    taken.add(key)    return key # u1 = claim_name('caf\u00e9', taken)       # NFC: U+00E9# u2 = claim_name('cafe\u0301', taken)      # NFD: e + U+0301
Run or narrate your approach, then ask the coach.