Making the Python Cookbook
by Bruce Stewart
O'Reilly has just released the Python Cookbook, a collection of problems, solutions, and practical examples written by a large cast of Python programmers. The book includes over two hundred recipes, with contributions from Python luminaries Guido van Rossum, Tim Peters, Paul Prescod, and Mark Hammond. Putting together such a collective work presented some unique challenges, and we recently spoke to the book's two editors, Alex Martelli and David Ascher, about the process.
Stewart: What inspired you to write the Python Cookbook?
Ascher: As I describe in the preface, the history of the book is quite convoluted. My late friend Frank Willison, who had edited "Learning Python", had been talking to me about my "next Python book" for some time. We'd batted around the idea of a JPython book (the name Jython wasn't around yet), and other topics, and then I got hired by ActiveState, which resulted in a significant decline in the number of hours I could spend writing Python books (luckily, the number of hours writing Python /code/ increased dramatically!). Months later, Frank and ActiveState's CEO Dick Hardt figured out that it was in both companies' interest to cooperate on a cookbook--ActiveState would run the online submission process, and O'Reilly would print it. Neither of them had a clue how much work would be involved, I'm sure--although maybe Frank did, and simply decided to avoid warning me!
Martelli: I knew a cookbook was just what Python needed--when David Ascher and Laura Lewin invited me to join the existing project I jumped at the opportunity.
Actually, I wanted to do a cookbook even before I knew O'Reilly was already planning one with ActiveState--I had sent a proposal for one, although ActiveState's "community-written" idea had rightly been preferred, and by then I had changed my plans to write the Python Nutshell book instead.
Stewart: How does Python lend itself to the cookbook approach?
Martelli: Learning the language is like learning to drive; the cookbook is like a series of maps accompanied by tips from expert drivers who often go there and can tell you which intersection to avoid as overcrowded, what tempting shortcuts to take, and which ones to avoid and why. Makes your driving, oops programming, far more enjoyable and productive than having to find it out all by yourself by unaided trial and error!
Stewart: How many recipes are there in the Python Cookbook, and how many different people contributed to the final product?
Martelli: Over 200 recipes, from over 100 contributors.
Stewart: Was it difficult to work with so many contributors? What were some of the challenges of putting together this kind of book?
Martelli: It was a real challenge to both respect the individuality and diversity of each contributor's style and ideas, and the uniformity of presentation and style expected from an O'Reilly cookbook. We did our best to meet these two apparently conflicting goals, keeping in mind that there's a meta-goal they both stem from: give the reader of the book the maximum value, in terms of both clarity and ease of reading (best served by uniformity) and also exposure to a wide range of individuals' approach to Python (best served by diversity). So, each time an editing decision had to be made, the meta-goal of "maximum value to the reader" was always foremost in our mind.
Our execution of these principles may not have been always impeccable--we were, after all, breaking new ground with this "multiple-authorship, open source cookbook," and, as the saying goes, "You can always tell the pioneers by the arrows in their backs." But I think the principles are correct and valuable, and worth keeping in mind for every editor and author: "you're doing all of this for readers--so the right choice in each and every case is the one that maximizes benefits to readers".
Ascher: Alex's answer is a good one. I'll just add the following:
One of the challenges that Alex was (happily, I'm sure) not exposed to was the difficulty of designing a Web site that was a "book entry form". In most "edited volumes," the editors get to coordinate with all of their preselected authors, assigning a chapter and topic to each, setting general editorial guidelines, and ensuring uniformity of coverage and equal representation to the important voices in the field is relatively easy.
Here, authors were self-selected, and wrote about the topics that they cared about. While we managed to do more of the traditional author-management when it came to finding introduction authors, the pool of recipes was very uneven. Some sections were extremely rich (for example, the "Algorithms" and "Object-Oriented" chapters), while other sections had to be dispersed throughout other chapters. One such example of this is Jython because for whatever reason, few recipes specific to Jython were submitted. Having Alex around to help fill in the gaps was crucial to the book's successful completion.
Pages: 1, 2