Alphanumeric sorting
Ned Batchelder (the author of the coverage.py module) has a succinct alphanumeric sort:
import re
def tryint(s):
try:
return int(s)
except:
return s
def alphanum_key(s):
“”" Turn a string into a list of string and [...]