下面这段代码output是100,也是正确的output ,在class CountingStack(Stack)的 def pop(self)函数里我没有
写return Stack.pop(self), output也是出来100, 这个return statement 是不是多余的?
```python
class Stack:
def __init__(self):
self.__stk = []
def push(self, val):
self.__stk.append(val)
def pop(self):
val = self.__stk[-1]
del self.__stk[-1]
return val
class CountingStack(Stack):
def __init__(self):
Stack.__init__(self)
self.__counting=0
def get_counter(self):
return self.__counting
def pop(self):
self.__counting+=1
return Stack.pop(self)
stk = CountingStack()
for i in range(100):
stk.push(i)
stk.pop()
print(stk.get_counter())
```