I wonder what causes one version to be faster for positive, and the other faster for negative numbers? I can see that the pos-version doesn't make as many iterations as the neg version, but it doesn't pad the length of the result to the requested number of digits and potentially produces more digits.
I also wonder if it wouldn't be faster to put the numbers into a list and join the list into a string -- did you test with that? Cheers, --Tim -- http://mail.python.org/mailman/listinfo/python-list