On this page:
Introduction
|
Methods
Introduction
The Stack class manages the Stack object. It’s a straightforward LIFO stack. It supports pushing and popping, as any good stack should. It is based on Python’s list object.
Methods
push (item or list)
Appends the item to the end (top) of the stack. If push is passed a list, the stack’s list is extended, so the top of the stack will be one item, not the list.
pop
Removes and returns the top of the stack. If the stack is empty it raises a PopError exception.
isEmpty
Returns a boolean value of True if the stack is empty, otherwise it returns False.
clear
Removes all items from the stack.
top
Returns the top of the stack, but doesn’t remove it from the stack (unlike the pop method).