Skip to content

Commit 2ca9b08

Browse files
Merge pull request #13 from aligheshlaghi97/feat/channels-vs-queues
fix: Intrudoced channels and added a comparison between channels and queues
2 parents d8c5a90 + 9f94e3a commit 2ca9b08

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/5. Advanced Techniques/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ Let's take a look at
7272
As Cristian Prieto says, in this example, `asyncio.Queue` is our way to communicate between the producer of items
7373
and its consumer, it will await until the queue has an item to give us.
7474

75+
### Channels vs Queues
76+
The term channel is used in languages like Golang and Kotlin. Channel is not exactly the same as queue.
77+
In short, a queue is a storage mechanism, while a channel is a communication mechanism (which may internally use a queue).
78+
Actually, a queue is a data structure that stores elements in a first-in, first-out (FIFO) order,
79+
while a channel is a communication mechanism that allows asynchronous data transfer between different parts of a program.
80+
7581
## asyncio Future
7682
[Future objects are used to bridge low-level callback-based code with high-level async/await code.
7783
](https://docs.python.org/3/library/asyncio-future.html)

0 commit comments

Comments
 (0)