Rune Strand <rst at _nospam_.drlug.org._nospam_> writes: You could try timing something like while n: n,d = divmod(n, 10) foo(d) That processes the digits in reverse order, of course.