This is a little faster: def number_format(num, places=0): """Format a number according to locality and given places""" locale.setlocale(locale.LC_ALL, "") return locale.format("%.*f", (places, num), True) I tested this ok with my test