Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '3.2': 0.05; 'sure.': 0.05; 'python': 0.08; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'statement.': 0.09; 'double-quote': 0.16; 'mistake.': 0.16; 'loop': 0.22; 'literal': 0.23; 'subject:Question': 0.25; 'noticed': 0.26; 'windows': 0.26; 'server': 0.29; 'around.': 0.29; 'second': 0.29; 'ran': 0.30; 'thanks': 0.31; 'it.': 0.33; 'skip:" 20': 0.33; 'to:addr:python-list': 0.34; 'header:X-Complaints- To:1': 0.34; 'someone': 0.34; 'post': 0.34; 'statement,': 0.35; 'explain': 0.36; 'but': 0.37; 'using': 0.37; 'received:org': 0.38; 'two': 0.38; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'received:41': 0.71; '100000': 0.84; 'surround': 0.84; 'swap': 0.84; '2003.': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: "Frank Millman" Subject: Question about timeit Date: Fri, 22 Jul 2011 08:06:27 +0200 Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 41-135-212-210.dsl.mweb.co.za X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.3790.4657 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4862 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1311314829 news.xs4all.nl 23961 [2001:888:2000:d::a6]:53798 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:10076 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