promptdojo_

Closures and the @ symbol — what AI is doing when it stacks decorators — step 7 of 9

AI wrote a decorator that runs the wrapped function but forgets to return its value. So the decorated function returns None and the script prints None instead of 5. Add a return to the wrapper so the script prints 5.

The break is on line 4 — but read the whole snippet first.

full-screen editor opens — close anytime to keep reading.