> 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
You shouldn't even need the call to super in that method, a simple
'len(self)' ought to be sufficient. Note that using the list object's
append method is going to be much more efficient than handling it yourself
anyways.
There are a few problems in your call to super. First, it's a callable - it
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)
self.insert(my_le