question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Support for Python collections.deque

See original GitHub issue

Feature request

The official Python 3.9.7 documentation shows a few containers and their descriptions

Being specific, deque is still a popular FIFO implementation option for its robustness and performance, as in this StackOverflow thread.

I searched Numba forums and issues for deque support, but I didn’t find any clue about it. Are there intentions to support it? Are there technical difficulties in implementing it?

The only mention of an attempt at creating a FIFO with Numba JIT is from this other SO question, but it’s definitely not robust and performant as collections.deque.

I first found about this problem when trying to learn how to use @jitclass with a very simple delayed_adder class which uses a deque as a FIFO to output addition results delayed by a few cycles (function calls).

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:5
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
esccommented, Oct 6, 2021

As a newbie to python I think that data structures are the most noticeable, because after performing some math operations, algorithms is the next step to go (as a total new programmer). And algorithms require data structures as deque(that can be used as a queue), set and maybe dictionary

Yes, we do have set and dict and list support, I think even for collections.heapq. Support is growing. If you need single ended queue, you can use list. I mean, you can use list to implement a deque easily, but removing items from the front will be computationally expensive, whereas removing items from the end will have an amortized constant runtime cost.

2reactions
esccommented, Sep 17, 2021

@danilo-bc thank you for raising this, I have labelled it as a feature request accordingly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python's deque: Implement Efficient Queues and Stacks
Deques are sequence-like data types designed as a generalization of stacks and queues. They support memory-efficient and fast append and pop operations on...
Read more >
Deque in Python - GeeksforGeeks
Deque (Doubly Ended Queue) in Python is implemented using the module “collections“. Deque is preferred over a list in the cases where we ......
Read more >
collections — Container datatypes — Python 3.11.1 ...
Bounded length deques provide functionality similar to the tail filter in Unix. They are also useful for tracking transactions and other pools of...
Read more >
Python Deque Container in Python Collections - YouTube
Welcome to the video series on interesting topics of modern python programming. In this video we're talking about python deque, a container ...
Read more >
collections.deque is not recognised as MutableSequence #1125
In Python 3.5.1, deque should be a MutableSequence (https://bugs.python.org/issue23704) By mypy does not recognise it as such import typing ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found