On Mon, 14 Nov 2011 17:00:38 -0800, Russell E. Owen wrote:
> Oops, I stripped so much out of my example that I stripped the ugly bit.
> This is closer to the original and demonstrated the issue:
>
> def timeMethod(func):
> name = func.__name__ + "Duration"
> def wrapper(self, *args, **key
In article
,
Ian Kelly wrote:
> On Thu, Nov 10, 2011 at 2:52 PM, Russell E. Owen wrote:
> > I am trying to write a decorator that times an instance method and
> > writes the results to a class member variable. For example:
> >
> > def timeMethod(func):
> > def wrapper(self, *args, **keyArgs
On Thu, Nov 10, 2011 at 2:52 PM, Russell E. Owen wrote:
> I am trying to write a decorator that times an instance method and
> writes the results to a class member variable. For example:
>
> def timeMethod(func):
> def wrapper(self, *args, **keyArgs):
> t1 = time.time()
> res = fu
I am trying to write a decorator that times an instance method and
writes the results to a class member variable. For example:
def timeMethod(func):
def wrapper(self, *args, **keyArgs):
t1 = time.time()
res = func(self, *args, **keyArgs)
duration = time.time() - t1