One of my favorite sessions at OSCon this week was Teaching Creative Writing with Python. Adam Parrish talked about his course Reading and Writing Electronic Text, which he teaches at New York University as part of the Interactive Telecommunications Program (ITP). Although the title emphasizes teaching creative writing through programming, the reverse is also true: the course teaches programming through experimental writing.

So how exactly is Python programming useful in creative writing? Parrish's course doesn't deal with artificial intelligence, or attempts at creating narratives or creating interactive hypertext or anything like that. It covers, for lack of a better term, procedural poetry. Typically, a student takes a starting set of text, writes a Python program to modify that text and then interprets the results.

Parrish cited non-electronic procedural poetry experiments as inspirations for the course. For example, he talked about Raymond Queneau's Cent mille milliards de poèmes, a book in which the text has been cut into strips that can be re-arranged to create nearly endless configurations:

Photo by Thomas Guest. More photos of the book on Flickr.

Parrish also mentioned Ted Berrigan's Sonnets and David Melnick's PCOET. Parrish didn't mention them in his talk, but the course website also mentions Brion Gysin and William S. Burroughs' work with the cut-up technique.

Using these works as a springboard, Parrish teaches his students UNIX commands for working with text, Python text processing techniques (such as ranging from basic string manipulation to n-gram analysis) and regular expressions to help them create their own procedural texts. He says he chose Python because it's easy to use and has a lot of tools for working with text. Using computers students can process more text and do so more quickly than the physical methods used by the experimenters of the past.

Parrish says pacing is one of the most difficult issues faced in the class. Beginner programmers always feel the class moves too quickly, while experienced programmers find that it moves too slow.

Parrish's focus is clearly in creative writing and helping students explore text in new ways. But it's a really interesting experiment in helping art or humanities students learn to program (see our interview with Douglas Rushkoff (who is also a teacher at ITP on why everyone should learn to program). A similar model could also be used to inject the humanities into programming and engineering education.

Where to Find More

Many of the lessons can be found here and the code examples are in Github.