Skip to content

Instantly share code, notes, and snippets.

import time
import zlib
from threading import Lock, Thread
from typing import (
Literal,
Optional,
Protocol,
Sequence,
Type,
TypeAlias,
@cliffxuan
cliffxuan / coroutine_io.py
Created May 9, 2012 18:45 — forked from markwatson/coroutine_io.py
A python IO class that writes to a coroutine.
import io
class CoroutineIO(io.TextIOBase):
"""
Creates an writable IO interface to a coroutine.
"""
def __init__(self, coroutine):
"""
Creates a new IO object with a coroutine. The
coroutine should take no arguments.