My shot would be to test it like this on your platform like this: #!/usr/bin/env python import datetime, time t1 = datetime.datetime.now() for i in [str(x) for x in range(100)]: if int(i) == i: i + 1 t2 = datetime.datetime.now() print t2 - t1 for i in [str(x) for x in range(100)]: try: int(i) +1 except: pass t3 = datetime.datetime.now() print t3 - t2
for me (on python 2.4.1 on Linux on a AMD Sempron 2200+) it gives: 0:00:00.000637 0:00:00.000823 -- http://mail.python.org/mailman/listinfo/python-list