Doctests in Python

from blog Blog on Hillel Wayne, | ↗ original
Doctests are one of the most fascinating things in Python. Not necessarily because it’s particularly elegant or useful, but because it’s unique: I haven’t found another language that has a similar kind of feature. Here’s how it works. Imagine I was writing an adder: def add(a,b): return a + b There’s two kinds of ways we can test it. The first...