4 ms·
I'd agree too. For example, in `Stack` implementation: # to check if stack is empty def isEmpty(self): return self.stack == [] # for check
by prashnts 9y ago
I'd agree too. For example, in `Stack` implementation:
# to check if stack is empty
def isEmpty(self):
return self.stack == []
# for checking the size of stack
def size(self):
return len(self.stack)
this is weird. Why not use the `size` in `isEmpty`?
- daveFNbuck 9y agoEven weirder is just the fact that it bases the stack data structure on the Python list, which is already a fully-functional stack. If this is supposed to teach you how to build a stack, it should implement its own stack rather than just wrapping an existing one.