help - error when trying to call super class method

dontknowwhy88 dontknowwhy88 at
Sun Sep 9 00:50:47 CEST 2007

I am trying to extend list class to build a stack class -- see code below---
but I got an error when I try to call len method from list class here.. why?
Thanks in advance!

class Stackx(list):
  def push(self,x):      
      indx= super.len(x)
  def pop(self):
      return self[-1]
def test():
    myStack = Stackx([1, 2 ,3 ,4])
    print myStack
    print myStack
    print myStack.pop()

if __name__=='__main__':


Traceback (most recent call last):
  File "C:\Python25\", line 20, in <module>
  File "C:\Python25\", line 14, in test
  File "C:\Python25\", line 4, in push
    indx= super.len(x)
AttributeError: type object 'super' has no attribute 'len'

Be a better Heartthrob. Get better relationship answers from someone who knows.
Yahoo! Answers - Check it out. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list