标签:imp init tar __init__ ret import self append reset
import time class Timer(object): def __init__(self): self.tic() self.elapses = [] def tic(self): self.tstart = time.time() def toc(self, reset=True, memorize=True): elapse = round(time.time() - self.tstart, 3) if memorize: self.elapses.append(elapse) if reset: self.tic() def get(self): n = round(sum(self.elapses), 3) elapses = self.elapses + [ n, ] return elapses
标签:imp init tar __init__ ret import self append reset
原文地址:https://www.cnblogs.com/zwq-/p/14475615.html