Explain Python code
Paste Python, from a one-line comprehension to a decorator, and Vibe explains what it does in plain English.
Up to 1,500 characters (about 60 lines). Your code is sent to Unvibe and Anthropic to write the explanation. Don't paste keys or passwords. Common key formats are refused.
Vibe23 lines selected
Press Explain it for the sample, or paste your own code first.
What this Python sample shows
- decorators
@timedabovetotal_by_cityis shorthand fortotal_by_city = timed(total_by_city). Every call now goes throughwrapper, which runs the real function, prints how long it took and returns its result.- generators
read_rowsusesyield, so it hands back one row at a time instead of building a list. A large file never has to fit in memory at once.- comprehensions
- The last line is a dict comprehension: it builds a new dictionary from
totals, in city order, with each total rounded to 2 decimal places.
Good to know
@wraps(func)copies the original name and docstring ontowrapper. Without it,total_by_city.__name__would be"wrapper", which makes logs and tracebacks harder to read.for city, amount in read_rows(path)unpacks each row into exactly two values. A row with more or fewer commas raisesValueError.totals.get(city, 0)returns 0 the first time a city appears.collections.defaultdict(float)does the same job without the.get.round(total, 2)only changes what is returned. The running totals are plain floats, so usedecimal.Decimalwhen the amounts are money that must add up exactly.
Watch out: A header row such as city,amount crashes the function, because float("amount") raises ValueError. Skip it with next(f) before the loop, or read the file with the csv module.
Explain Python code beside your editor
Unvibe is a free app for Mac and Windows. In the app there is no pasting: select code in any app and press Control+U (Ctrl+Alt+U on Windows).
Install on Mac
curl -fsSL https://unvibe.site/install.sh | bashPaste into Terminal. Unvibe isn't notarized by Apple yet, so this is the smooth path.
Or download the .dmg · Intel Mac build · SHA-256 checksums
No install warning? Use Unvibe in your browser
Opening the .dmg the first time
- Open the .dmg and drag Unvibe to Applications.
- Open it once; macOS says it can't verify it. Click Done.

Real screen, macOS 15 - System Settings › Privacy & Security › Open Anyway. Confirm, then enter your Mac password. The button shows for about an hour after you try to open Unvibe.

Real screen, macOS 15
The Terminal line checks the download against the published SHA-256 and Unvibe's self-signed signature before it installs anything. More help with the first open