SPA Conference session: Program Decomposition With Python 2.5 Generators

One-line description:Use generators as co-routines to perform lightweight multitasking or asynchronous I/O
 
Session format: Workshop (150 mins) [read about the different session types]
 
Abstract:Contents

During this workshop you will explore a new way of writing programs that process data. You'll construct a data-processing program using co-routines, along the lines Jackson proposed with Jackson Structured Programming (JSP). Just as Jackson tried to improve writing Cobol programs without introducing new language concepts, this session is about to improve writing Python code with standard features present in de language.

The main goal is to simply writing socket handlers, HTTP handlers, and XML RPC (SOAP) handlers and the like. Things that are hard to get right in practise.

The session will shortly cover theoretical topics such as:
* Program decomposition as a necessity for developing large programs.
* The problem with threads and synchronous I/O
* Jackson Structured Programming: structure programs as data processing units
* The proposed solution: co-routines

The session will then be very practical, with worked out examples that use Python 2.5 generalized generators. Much time is dedicated to coding around a the examples, or your own problems:

Objectives

* Gain knowledge about how Python 2.5 generalized generators
* Learn how to use these as coroutines to perform lichtweight threading
* Get help from peer during discussions
* Share the insights with others (both the guys from Weightless and MultiTask surely appreciate feedback)
 
Audience background:Attendees must have programming experience. A short introduction into Python and generators is part of the session. This is a programmer's session.
 
Benefits of participating:You will have your brains working to get around the subtle problems that appear when you really want to use generators as coroutines as many have suggested but never done.
Back home, you will be a generator guru.
 
Materials provided:Source code examples. Exercises
 
Process:The session consists of a very short introduction with real life examples and source code to introduce the subject. It will then be two or three programming exersices, depending on time available.
Attendees preferably bring in their own problems as exercises.
 
Detailed timetable:0-5: lost
5:35: introduction
35-75: programming excercise
75-90: discussion
90-120: programming excercise continued
120-150: discussion
 
Outputs:Snippets of code.
Introduction into JSP (on CD)
 
History:None.
 
Presenters
1. Erik J. Groeneveld
Seek You Too Softwarestudio
2. Thijs Janssen
Seek You Too
3.