About 3,780,000 results
Open links in new tab
  1. How are deques in Python implemented, and when are they worse …

    Dec 10, 2015 · Check out collections.deque. From the docs: Deques support thread-safe, memory efficient appends and pops from either side of the deque with approximately the same …

  2. python - queue.Queue vs. collections.deque - Stack Overflow

    Python has at least two queue classes, queue.Queue and collections.deque, with the former seemingly using the latter internally. Both claim to be thread-safe in the documentation.

  3. python - efficient circular buffer? - Stack Overflow

    Mar 16, 2016 · I want to create an efficient circular buffer in python (with the goal of taking averages of the integer values in the buffer). Is this an efficient way to use a list to collect …

  4. Python deque: difference from list? - Stack Overflow

    I'm reading the Python Documentation: I don't understand how a deque is different from a list. From the documentation: Returns a new deque object initialized left-to-right (using append()) …

  5. python - How to check if a deque is empty - Stack Overflow

    Apr 13, 2011 · How to check if a deque is empty Asked 14 years, 8 months ago Modified 4 years, 2 months ago Viewed 108k times

  6. python - Clear all items from the queue - Stack Overflow

    Dec 16, 2017 · If you read the documentation, it refers you to the Queue module's latest source, and there you could see the that the internal representation of a FIFO queue is a deque. In the …

  7. How to check deque length in Python - Stack Overflow

    May 13, 2021 · from collections import deque queue = deque(["Eric", "John", "Michael"]) How to check the length of this deque? and can we initialize like

  8. python - collections.deque get index of element by value - Stack …

    May 1, 2016 · According to the pythons docs, if you have python3.5 or better, you can use index (as per tobspr's answer). For older pythons, you can convert the deque to a list and then use …

  9. Iterate over deque in python - Stack Overflow

    Since a deque is a doubly linked list, I should be able to iterate through it in order without any performance cost compared to a list. However, the following will be much slower than iterating …

  10. queue - How Does Deque Work in Python - Stack Overflow

    Jul 31, 2016 · I am having trouble understanding how the deque works in the snippet of code below, while trying to recreate a queue and a stack in Python. Stack Example - Understood …