Code Room
Code reviewHardcr-g481
Subject Missing cacheLevel Senior–Staff~22 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Python memoized renderer used in a long-running service.

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
_cache = {} def render(template_id, ctx):    key = (template_id, tuple(sorted(ctx.items())))    if key not in _cache:        _cache[key] = expensive_render(template_id, ctx)    return _cache[key]
Run or narrate your approach, then ask the coach.