DEV Community

Discussion on: Making a Stack Data Type in Python

Collapse
 
furtleo profile image
Leonardo Furtado

So it's unnecessary study and implement data structures in python cuz they are implemented already???? rofl

Collapse
 
cicirello profile image
Vincent A. Cicirello

That is not at all what I said. I said nothing about data structures more generally. However, you wouldn't implement a stack in python the way described in this post. Instead, if you were implementing a stack in python to learn about stacks, you would have a much simpler stack class wrapping a python list with methods for the stack operations implemented the way I described. It still gets across main point of using right end as top of stack.

Using a python list as if it was instead a simple array, as described in this post, just encourages bad python style.