Re: Data Structure in Python like STL Stack?

2005-11-28 Thread Fredrik Lundh
Matt Keyes wrote: > Is there a data structure in Python that is akin to the STL stack > object in C++? >>> import collections >>> help(collections.deque) ... class deque(__builtin__.object) | deque(iterable) --> deque object | | Build an ordered collection accessible from endpoints only.

Re: Data Structure in Python like STL Stack?

2005-11-28 Thread Matt Keyes
I didn't know the list has a pop function - that is what I was looking for.   Thanks for the help![EMAIL PROTECTED] wrote: What property of the STL stack is important to you?You can use a Python list as a stack. It has methods append() andpop() which run in amortized-constant-time. It can be tested

Re: Data Structure in Python like STL Stack?

2005-11-28 Thread jepler
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 pgpU1CCrfIPhk.pgp Description: PGP sig

Data Structure in Python like STL Stack?

2005-11-28 Thread Matt Keyes
Is there a data structure in Python that is akin to the STL stack object in C++?   Thanks!-- http://mail.python.org/mailman/listinfo/python-list