Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #10076 > unrolled thread
| Started by | "Frank Millman" <frank@chagford.com> |
|---|---|
| First post | 2011-07-22 08:06 +0200 |
| Last post | 2011-07-22 08:06 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
Question about timeit "Frank Millman" <frank@chagford.com> - 2011-07-22 08:06 +0200
| From | "Frank Millman" <frank@chagford.com> |
|---|---|
| Date | 2011-07-22 08:06 +0200 |
| Subject | Question about timeit |
| Message-ID | <mailman.1349.1311314829.1164.python-list@python.org> |
Hi all
I mentioned in a recent post that I noticed an inconsistency in timeit, and
then reported that I must have made a mistake.
I have now identified my problem, but I don't understand it.
C:\Python32\Lib>timeit.py "int(float('165.0'))"
100000 loops, best of 3: 3.52 usec per loop
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(float("165.0"))'
10000000 loops, best of 3: 0.0888 usec per loop
C:\Python32\Lib>timeit.py 'int(float("165.0"))'
10000000 loops, best of 3: 0.0887 usec per loop
I ran them both twice just to be sure.
The first two use double-quote marks to surround the statement, and
single-quote marks to surround the literal inside the statement.
The second two swap the quote marks around.
Can someone explain the difference?
I am using python 3.2 on Windows Server 2003.
Thanks
Frank Millman
Back to top | Article view | comp.lang.python
csiph-web