Created
September 26, 2023 10:31
-
-
Save nenetto/b6edec88ec18ba2392d4723debff7988 to your computer and use it in GitHub Desktop.
Double-ended Queue, Ordered dictionaries, default dictionary
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
# Double-ended Queue | |
fifo = collections.deque() | |
fifo.append(1) # Producer | |
x = fifo.popleft() # Consumer | |
# OrderedDict | |
a = OrderedDict() | |
a[‘foo’] = 1 | |
a[‘bar’] = 2 | |
b = OrderedDict() | |
b[‘foo’] = ‘red’ | |
b[‘bar’] = ‘blue’ | |
for value1, value2 in zip(a.values(), b.values()): | |
print(value1, value2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment