应该是说,在外部是可以修改__count属性的,但是不能访问,所以在Class外面打Print Person.__count会报错,但是如果在里面写一个打印的命令的话会看到__count是有加一的
2016-07-18
ef performance(unit):
def pd(f):
@functools.wraps(f)
def w(x):
t1 = time.time()
r = f(x)
t2 = time.time()
t = (t2 - t1) * 1000 if unit == ms else (t2-t1)
print 'call %s() in %f %s' % (f.__name__, t, unit)
return r
return w
return pd
def pd(f):
@functools.wraps(f)
def w(x):
t1 = time.time()
r = f(x)
t2 = time.time()
t = (t2 - t1) * 1000 if unit == ms else (t2-t1)
print 'call %s() in %f %s' % (f.__name__, t, unit)
return r
return w
return pd
2016-07-18
已采纳回答 / zzzzzza
f是一个类,_name_s 则是该类的一个属性,例如class fif(): def __init__(self,_name_s): self._name_s =_name_sf=fif(1); print (f._name_s)
2016-07-17
已采纳回答 / 我的心属于你
if self.score < s.score: return 1 elif self.score < s.score: return -1判断条件一模一样,返回值不同。 需要把其中一个的符号改一下
2016-07-17