← Stripe Interview Insights

Stripe·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Stripe technical screen for a software engineer role, focused entirely on debugging a broken Mako template. Pretty niche stuff if you haven't touched Mako recently.

Questions Asked (1)

Q1

Given a Python script using the Mako templating library that produces unexpected rendered output, identify the root cause (variable interpolation, control-flow, template inheritance/include, or escaping) and fix it. Then walk through what the corrected output looks like and explain why the original broke.

Root Cause AnalysisTechnical Trade-offsAPI & Integrations
Author's notes

I hadn't used Mako in maybe two years so the first few minutes were rough.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by reproducing the bug and isolating the template section causing the unexpected output. Systematically check each category (variable interpolation, control flow, inheritance/include, escaping) to identify the root cause, then apply the minimal fix and verify the corrected output. Finally, explain the original behavior and why the fix resolves it, emphasizing preventive measures.

Pro tip: Demonstrate deep Mako knowledge by mentioning that Mako does not autoescape by default, so you must explicitly use filters like `| h` or set `default_filters=['h']` to prevent HTML injection and unexpected rendering.

1. Reproduce and Isolate

Run the script to confirm the unexpected output, then narrow down to the specific template block or expression responsible by commenting out sections or using debug prints.

2. Categorize the Root Cause

Check each category: variable interpolation (e.g., missing `${}` or wrong variable name), control flow (e.g., incorrect loop/conditional logic), inheritance/include (e.g., wrong `inherit` or `include` path), and escaping (e.g., unescaped HTML).

3. Apply the Fix

Make the minimal change to correct the issue, such as adding `${}` around a variable, fixing a loop condition, correcting the inheritance directive, or adding an escape filter.

4. Verify and Explain

Re-run the script to confirm the corrected output, then walk through the original broken output and explain why the fix works, referencing Mako's behavior.

Key Points to Mention

  • Mako's syntax for variable interpolation: `${variable}` and the difference between `${}` and `<% %>` blocks.
  • Control flow constructs in Mako: `% for`, `% if`, `% endif`, and how indentation or missing `%` can cause issues.
  • Template inheritance: `<%inherit file="base.mako"/>` and includes: `<%include file="header.mako"/>` and common pitfalls like wrong paths or missing inheritance.
  • Escaping: Mako does not autoescape by default; use `| h` filter or set `default_filters=['h']` to escape HTML, and the `n` filter to disable escaping.
  • Debugging techniques: using `context.write()` or `print` statements in templates, and checking the generated Python code with `template.code`.
  • Best practices: enable strict undefined variables, use `default_filters` for security, and write unit tests for template rendering.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.