About 4,700,000 results
Open links in new tab
  1. 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 …

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

    I need a queue which multiple threads can put stuff into, and multiple threads may read from. Python has at least two queue classes, queue.Queue and collections.deque, with the former …

  3. 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 …

  4. python - How to slice a deque? - Stack Overflow

    Apr 4, 2012 · deque_slice = collections.deque(itertools.islice(my_deque, 10, 20)) Indexing into a deque requires following a linked list from the beginning each time, so the islice() approach, …

  5. 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 …

  6. 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

  7. 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 …

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

    May 1, 2016 · For list we can get index of element list_name.index (3) How to get index of item in deque. ex: d_list = deque ( [1, 2, 3, 4]) what is the best way to get the index of element 3.

  9. 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 …

  10. python - deque.popleft () and list.pop (0). Is there performance ...

    Sep 13, 2015 · deque.popleft() and list.pop(0) seem to return the same result. Is there any performance difference between them and why?