Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; '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; 'subject:" ': 0.10; 'received:173.11': 0.16; 'subject:=': 0.16; 'resolution': 0.21; 'result.': 0.21; 'header:In-Reply-To:1': 0.22; 'windows': 0.26; 'van': 0.26; 'loop': 0.28; 'ran': 0.30; 'to:addr:python-list': 0.33; '...': 0.34; 'header:User-Agent:1': 0.34; 'richard': 0.34; 'corp.': 0.34; 'header:X-Complaints-To:1': 0.35; 'issue': 0.36; 'received:org': 0.38; 'subject:: ': 0.39; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'subject: (': 0.39; 'hit': 0.40; "it's": 0.40; 'minimum': 0.40; 'more': 0.60; 'copyright': 0.62; 'subject:+': 0.73 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Emile van Sebille Subject: Re: relative speed of incremention syntaxes (or "i=i+1" VS "i+=1") Date: Mon, 22 Aug 2011 10:22:25 -0700 References: <4e513ceb$0$23863$e4fe514c@news2.news.xs4all.nl> <1313947658.3424.3.camel@thegeorge> <4e51ad16$0$29975$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 173-11-108-137-sfba.hfc.comcastbusiness.net User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0) Gecko/20110812 Thunderbird/6.0 In-Reply-To: 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1314033759 news.xs4all.nl 23982 [2001:888:2000:d::a6]:35558 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:12040 On 8/22/2011 9:35 AM Emile van Sebille said... > On 8/22/2011 2:55 AM Richard D. Moores said... >> Coincidence? >> > > Naaa.. I just ran it twice -- once per ... _this_ is coincidence. :) > > Microsoft Windows XP [Version 5.1.2600] > (C) Copyright 1985-2001 Microsoft Corp. > > C:\Documents and Settings\Emile>python -m timeit -r 3 -s "n=0" "n=n+1" > 10000000 loops, best of 3: 0.108 usec per loop > > C:\Documents and Settings\Emile>python -m timeit -r 3 -s "n=0" "n += 1" > 10000000 loops, best of 3: 0.108 usec per loop Actually, it's more likely I hit a minimum resolution issue -- I ran it twenty more times and never got a different result. Emile