Code Room
Code reviewMediumcr-g211
Subject Phantom readLevel Mid–Senior~22 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Python (SQLAlchemy) signup handler that enforces unique emails.

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 register(session, email, pw_hash):    existing = session.query(User).filter_by(email=email).first()    if existing:        raise EmailTaken(email)    user = User(email=email, pw_hash=pw_hash)    session.add(user)    session.commit()    return user
Run or narrate your approach, then ask the coach.