help - error when trying to call super class method
mccredie at gmail.com
Mon Sep 10 07:29:38 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!
Jeff did a good job of answering your questions. I just wanted to note
that your pop is broken, but that doesn't matter since list already
has a pop method that will do what you want. Actually it has a push
method that does what you want too, it is called `append'. If you
really want a push method, you could just do this:
>>> class Stack(list):
... push = list.append
>>> s = Stack()
More information about the Python-list