Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
using a list as a stack
#3
Before "reinventing the wheel", check collections.deque. That's what you want, even if you need to inherit from the built-in class.
Quote:Deques are a generalization of stacks and queues (the name is pronounced “deck” and is short for “double-ended queue”). Deques support thread-safe, memory efficient appends and pops from either side of the deque with approximately the same O(1) performance in either direction.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
using a list as a stack - by Skaperen - Feb-25-2019, 06:28 AM
RE: using a list as a stack - by woooee - Feb-25-2019, 06:32 AM
RE: using a list as a stack - by Skaperen - Feb-25-2019, 07:41 PM
RE: using a list as a stack - by buran - Feb-25-2019, 07:26 AM
RE: using a list as a stack - by Skaperen - Feb-25-2019, 08:43 PM
RE: using a list as a stack - by buran - Feb-25-2019, 08:46 PM
RE: using a list as a stack - by Skaperen - Feb-25-2019, 09:25 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020