I have the following code:
class Stat(list):
def __init__(self, lst = []):
self.s = list(lst)
def __repr__(self):
return "Stat({})".format(self.s)
def add(self, item):
self.s.append(item)
def len(self):
return len(self.s)
...(more methods, but not necessary)
All of the methods work properly but len()
. No matter the length of the Stat
object, the returned length is always 0; I don't understand why.