 <p>This is another approach, using more iterables and more relying on defaults:</p> <pre><code>from itertools import imap, islice, izip def find_min_diff(iterable, sort_func=sorted): sorted_iterable = sort_func(iterable) return min(imap( lambda a, b: b - a, izip(sorted_iterable, islice(sorted_iterable, 1)), )) </code></pre>