When I call the displaycount method of my list subclass, I get no output. What is the problem?
class mylist(list):
def _init_(self,name,age):
list._init_(self, years)
self.name = name;
self.age = age;
def displaycount(self):
print "total employees %d" % self.name
emp1 = mylist('lada', 20)
emp1.displaycount()
mylistclass for it's__init__method to be called. You'll also have to call thedisplaycountand perhaps fix your indentationdisplaycountonly inside itself, which might cause infinite recursion if you actually call it once from outside ...displaycountis nested inside_init_(which has the wrong number of underscores!)