Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on A Python Guide for the Ages. Parent comment
Before being introduced to `for`/`else`, I'd have written the example you gave as:
result = None for i in range(n): if search(i) == val: result = i if not result: raise KeyError("not found")
There are no comments on this comment yet.
Before being introduced to `for`/`else`, I'd have written the example you gave as: