Skip to content

Instantly share code, notes, and snippets.

@foarsitter
foarsitter / producer_consumer.py
Last active January 22, 2024 15:28 — forked from showa-yojyo/producer_consumer.py
Implement Producer/Consumer pattern with asyncio.Queue
"""
DRY approach of https://gist.github.com/showa-yojyo/4ed200d4c41f496a45a7af2612912df3
"""
import asyncio
import random
from collections.abc import Callable
async def producer(n):