-
Notifications
You must be signed in to change notification settings - Fork 1k
WIP: Update deque #440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Update deque #440
Conversation
This could possibly be merged as-is (I had to extend deque to supporting porting the progress library to MicroPython) but I'm going to try and add all the other features of deque as well as use as much as possible of the CPython test cases. |
8afdbae
to
908d2a3
Compare
def pop(self): | ||
return self.q.pop() | ||
|
||
def append(self, a): | ||
self.q.append(a) | ||
if self.__maxlen is not None and len(self.q) > self.__maxlen: | ||
self.popleft() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could do this bit before appending, to use less memory for the list
9086d83
to
a15208c
Compare
chiming in that this helped make some of my cpython code be micropython-compatible. |
Note that the built-in deque has had some substantial improvements, see: micropython/micropython@7dff38f There is little reason to use this Python version now - which is great! |
Now that the core |
I agree; the differences are minimal, so I'll close this. Fantastic to see the built-in deque improved! |
MicroPython's built-in deque lacks many features but is implemented in C so is very lean and fast.
The micropython-lib version is implemented in Python and has more features - but should have even more. This is a start toward achieving feature-parity with CPython's deque.