Re: [Tutor] Generator next()

2013-12-28 Thread Keith Winston
On Sat, Dec 28, 2013 at 4:45 AM, Steven D'Aprano wrote: > That's my idea of an instrumented function :-) > > Feel free to ask for a explanation of how it works. > Hey Steve or anyone: That seems like a very clean timer function, and while I have it working I only understand it caricaturistically

Re: [Tutor] Generator next()

2013-12-28 Thread eryksun
On Sat, Dec 28, 2013 at 4:45 AM, Steven D'Aprano wrote: > Anyway, if I'm going to criticise, I ought to show what I consider > better. Here's a quick and unpolished decorator for instrumenting > functions. For simplicity, it too will be inaccurate for Windows and > really fast/small functions, but

Re: [Tutor] Generator next()

2013-12-28 Thread Steven D'Aprano
On Fri, Dec 27, 2013 at 01:14:42PM -0500, Keith Winston wrote: > I am beginning to think about decorators, generators, and the like. [...] > Here's the code, stolen without apology from here: > http://enja.org/2011/03/09/a-python-function-timing-decorator/ > > import time > > class Timing(object)