1 / 9

The Promise You've Already Made

Back when files first turned up, with came with a promise attached: the file gets closed when the block ends, and it gets closed even if the code inside falls over.

That promise was never really about files. It's about the kind of job that has to happen whatever else happens: the till gets counted, the door gets locked, the "finished" line gets printed. Even on the days when everything goes wrong.

Python has a word for that kind of job.