Data Structure in Python like STL Stack?

jepler at unpythonic.net jepler at unpythonic.net
Mon Nov 28 10:11:15 EST 2005


What property of the STL stack is important to you?

You can use a Python list as a stack.  It has methods append() and
pop() which run in amortized-constant-time.  It can be tested for
empty/nonempty in constant time too (if st: # stack is not empty).

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20051128/c5305063/attachment.sig>


More information about the Python-list mailing list