Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'context': 0.07; 'subject:skip:b 10': 0.07; 'exceeds': 0.09; 'lawrence': 0.09; 'url:activestate': 0.09; 'bug': 0.12; '>on': 0.16; 'block.': 0.16; 'emits': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'lurking': 0.16; 'message- id:@cskk.homeip.net': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:cskk.homeip.net': 0.16; 'received:homeip.net': 0.16; 'received:optusnet.com.au': 0.16; 'received:syd.optusnet.com.au': 0.16; 'simpson': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'case.': 0.24; 'issue,': 0.24; 'cheers,': 0.24; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'url:code': 0.29; "i'm": 0.30; 'code': 0.31; '+0100,': 0.31; "d'aprano": 0.31; 'fans': 0.31; 'steven': 0.31; "who'd": 0.31; 'allows': 0.31; 'class': 0.32; 'run': 0.32; 'fri,': 0.33; 'test': 0.35; 'but': 0.35; 'there': 0.35; 'version': 0.36; 'received:com.au': 0.36; 'useful': 0.36; 'charset:us-ascii': 0.36; "i'll": 0.36; 'positive': 0.37; 'being': 0.38; 'manager': 0.38; 'received:211': 0.38; 'to:addr:python-list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'here:': 0.62; 'content- disposition:inline': 0.62; 'within': 0.65; 'here': 0.66; '1993': 0.84; 'explorer': 0.84; 'forward,': 0.84 Date: Fri, 13 Jun 2014 12:14:40 +1000 From: Cameron Simpson To: python-list@python.org Subject: Re: http://bugs.python.org/issue19495 timeit enhancement MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <539a4967$0$29988$c3e8da3$5496439d@news.astraweb.com> User-Agent: Mutt/1.5.21 (2010-09-15) References: <539a4967$0$29988$c3e8da3$5496439d@news.astraweb.com> X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=U6SrU4bu c=1 sm=1 tr=0 a=YuQlxtEQCowy2cfE5kc7TA==:117 a=YuQlxtEQCowy2cfE5kc7TA==:17 a=ZtCCktOnAAAA:8 a=PO7r1zJSAAAA:8 a=LcaDllckn3IA:10 a=x02A23IAYpIA:10 a=nHQQb0JHnrgA:10 a=HEO8UGUXSW0A:10 a=kj9zAlcOel0A:10 a=8AHkEIZyAAAA:8 a=vrnE16BAAAAA:8 a=kZ7UWmmPAAAA:8 a=s07OA_tJAAAA:8 a=QrVWhbZvAAAA:8 a=Lc7UE8JNFfaYOTWYcKUA:9 a=CjuIK1q_8ugA:10 a=pyH5b1fOeEsA:10 a=qK-0qqH4L_EA:10 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1402627515 news.xs4all.nl 2923 [2001:888:2000:d::a6]:34501 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:73248 On 13Jun2014 00:44, Steven D'Aprano wrote: >On Fri, 13 Jun 2014 00:35:43 +0100, Mark Lawrence wrote: >> The request is for a class within timeit that allows you to test code >> inside a with block. It strikes me as being useful but there's only one >> response on the issue, albeit a positive one. If others here think this >> would be a useful addition I'll see if I can take this forward, unless >> there are any timeit fans lurking who'd like to run with it themselves. > >I have a Stopwatch() context manager which I have been using for a long >time, very successfully. There's an early version here: > >http://code.activestate.com/recipes/577896 > >I'll clean it up and submit it on the bug tracker. And I have a LogTimer context manager that emits a log message when a with suite exceeds a threshold. I'm sure it is far cruder and limited than Steven's; I'm mentioning it in support of the use case. Cheers, Cameron Simpson 1993 Explorer - Cage? Hell, it's a prison. - Will Hartung vfr750@netcom.com