작성
·
267
0
하신대로따라 그대로 해봤는데 자꾸 다음과 같은 에러가??
몇번을 필기해보았는데도 불구하고 ㅜㅜ
class Averager():
def __int__(self):
self._series = []
def __call__(self, v):
self._series.append(v)
print('inner >> {} / {}'.format(self._series, len(self._series)))
return sum(self._series) / len(self._series)
# 인스턴스 생성
averager_cls = Averager()
print(dir(averager_cls))
# 누적
print(averager_cls(10))
---------------------------------------------------------
Traceback (most recent call last):
File "C:\p_study\p_chapter05_02.py", line 66, in <module>
print(averager_cls(10))
File "C:\p_study\p_chapter05_02.py", line 57, in __call__
self._series.append(v)
AttributeError: 'Averager' object has no attribute '_series'