Make a working implementation of async functions in Python 2.1
summary
Builds a working async/coroutine system that runs on Python 1.6 by reimplementing three pieces: yield-from emulation via a stack of iterators (works back to ~2.2), a hand-rolled bidirectional channel protocol that mimics send/throw (covers 2.5 semantics), and a tiny bytecode patching resume trick driven by sys.settrace to jump to the next source line. Code patches a function’s code object with the marshal/C API, so suspendable coroutines work (locals omitted) and the demo runs on Python 1.6.
AI-written summary · about
chapters (18)
- 0:00Introduction and apology
- 0:48Why modern Python feels complex
- 2:15What are async functions
- 3:40Challenges in Python 1.6
- 4:22Async/await syntax basics
- 5:26Generator delegation with yield from
- 7:36Implementing yield from manually
- 9:21Bidirectional communication with channels
- 11:29The role of yield in Python
- 12:55Exploring Python bytecode
- 14:41Tracing execution with sys.settrace
- 16:49Building a suspendable class
- 18:36Unsuspending with patched bytecode
- 20:44Testing async in Python 1.6
- 21:50Why newer Python is better
- 22:54History of Python features
- 26:26Python’s design philosophy
- 28:12Summary and Q&A
related talks
29mLet's make a working implementation of async functions in Python 2.1, also, why you might want to us
35mHow Do Python Coroutines Work?
33mArtisanal Async Adventures
01h 00mCoroutine Concurrency in Python 3 with asyncio
01h 29mStandardised Coroutine Concurrency in Python 3
01h 23mPython async/await unraveled
01h 21mTUTORIAL: Async Python, Good it is
59mGet to grips with asyncio in Python 3
