Skip to content

Instantly share code, notes, and snippets.

@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.
@cliffxuan
cliffxuan / defer.py
Created April 28, 2012 23:16
wxPython non blocking gui with long running task and timeout
import sys
import threading
import Queue
import wx
_noTimeoutDefault = object()
def defer(
returnToFunction,
function,