Created
August 6, 2018 15:05
-
-
Save jmfrank63/5fb9909a8e06c91dead9265cab2f33de to your computer and use it in GitHub Desktop.
Async deque in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
class AsyncDeque(deque): | |
def __init__(self, elements): | |
super().__init__(elements) | |
def __aiter__(self): | |
return self | |
async def __anext__(self): | |
if not self: | |
raise StopAsyncIteration | |
element = self.popleft() | |
return element |
agronick
commented
Dec 13, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment