Convert '165.0' to int

Frank Millman frank at chagford.com
Thu Jul 21 07:23:42 EDT 2011


>
> [1] See separate thread on apparent inconsisteny in timeit timings.- Hide quoted text -
>

I must have done something wrong - it is consistent now.

Here are the results -

C:\Python32\Lib>timeit.py "int(float('165.0'))"
100000 loops, best of 3: 3.51 usec per loop

C:\Python32\Lib>timeit.py "int('165.0'[:-2])"
100000 loops, best of 3: 4.63 usec per loop

Frank



More information about the Python-list mailing list