I pretty often use Python instead of pseudocode. For this, I would like to have a stack. I know that using lists is the way ( source ), but I would like to use myList.push , not myList.append , to make it clear that I am using the stack.
I thought I could do something simple, like
myList.push = myList.append
to define an alias for the add operation, but I get
stack.push = stack.append AttributeError: 'list' object has no attribute 'push'
Is there a short solution for adding a push operation to a list?
(This should not ruin my Python executable pseudo-code)
source share