← 学习库 Think Python (2e) · 中英对照 目录

Chapter 0  Preface 第 0 章 前言

本页译自 Think Python 2e(Allen B. Downey)· Chapter 0 Preface。代码块保留英文原文不翻译;正文段段对照,中文块可用右下角按钮隐藏。

The strange history of this book 本书的奇特历史

In January 1999 I was preparing to teach an introductory programming class in Java. I had taught it three times and I was getting frustrated. The failure rate in the class was too high and, even for students who succeeded, the overall level of achievement was too low.

1999 年 1 月,我正准备教一门 Java 入门编程课。这门课我已经教过三次,越来越感到沮丧。班级的失败率太高了,而且即便对那些学下来的学生来说,整体的掌握程度也太低。

One of the problems I saw was the books. They were too big, with too much unnecessary detail about Java, and not enough high-level guidance about how to program. And they all suffered from the trap door effect: they would start out easy, proceed gradually, and then somewhere around Chapter 5 the bottom would fall out. The students would get too much new material, too fast, and I would spend the rest of the semester picking up the pieces.

我看到的问题之一出在教材上。它们太厚,充斥着 Java 大量不必要的细节,却缺乏关于如何编程的高层指导。而且它们都逃不开「活板门效应」:开头轻松,循序渐进,然后大约在第五章附近地板突然塌掉。学生会在短时间内被塞进太多新内容,而我得用整个学期剩下的时间帮他们收拾残局。

Two weeks before the first day of classes, I decided to write my own book. My goals were:

在开课两周前,我决定自己写一本书。我的目标是:

I needed a title, so on a whim I chose How to Think Like a Computer Scientist.

我需要一个书名,于是心血来潮选了《如何像计算机科学家一样思考》。

My first version was rough, but it worked. Students did the reading, and they understood enough that I could spend class time on the hard topics, the interesting topics and (most important) letting the students practice.

我的初版很粗糙,但管用。学生做了阅读,理解得足够好,于是我可以把课堂时间花在难懂的、有趣的话题上——而最重要的是——让学生去练。

I released the book under the GNU Free Documentation License, which allows users to copy, modify, and distribute the book.

我以 GNU 自由文档许可证发布了这本书,它允许用户复制、修改和分发本书。

What happened next is the cool part. Jeff Elkner, a high school teacher in Virginia, adopted my book and translated it into Python. He sent me a copy of his translation, and I had the unusual experience of learning Python by reading my own book. As Green Tea Press, I published the first Python version in 2001.

接下来发生的事才是最酷的。Jeff Elkner,弗吉尼亚州的一名高中老师,采用了我的书并把它翻译成了 Python。他寄给我一份译本,于是我有了一种奇特的经历:通过读自己的书来学 Python。以 Green Tea Press 的名义,我在 2001 年出版了第一个 Python 版本。

In 2003 I started teaching at Olin College and I got to teach Python for the first time. The contrast with Java was striking. Students struggled less, learned more, worked on more interesting projects, and generally had a lot more fun.

2003 年我到 Olin 学院任教,第一次有机会教 Python。与 Java 的对比令人惊讶。学生少受挫折、学得更多、做的项目更有意思,总体而言开心得多。

Over the last nine years I continued to develop the book, correcting errors, improving some of the examples and adding material, especially exercises.

在之后的九年里,我持续地完善这本书,纠正错误、改进部分示例并补充内容,尤其是习题。

The result is this book, now with the less grandiose title Think Python. Some of the changes are:

成果就是这本书,现在换了个不那么夸张的书名《Think Python》。其中一些变化是:

I hope you enjoy working with this book, and that it helps you learn to program and think, at least a little bit, like a computer scientist.

希望你喜欢使用这本书,也希望它能帮你学会编程、并至少稍微像计算机科学家那样思考。

Allen B. Downey
Needham MA
Allen Downey is a Professor of Computer Science at the Franklin W. Olin College of Engineering.

Allen B. Downey
Needham MA
Allen Downey 是 Franklin W. Olin 工程学院的计算机科学教授。

Acknowledgments 致谢

Many thanks to Jeff Elkner, who translated my Java book into Python, which got this project started and introduced me to what has turned out to be my favorite language.

非常感谢 Jeff Elkner,他把我的 Java 书翻译成了 Python,让这个项目得以启动,也让我结识了后来成为我最爱的一门语言。

Thanks also to Chris Meyers, who contributed several sections to How to Think Like a Computer Scientist.

也感谢 Chris Meyers,他为《如何像计算机科学家一样思考》贡献了若干章节。

Thanks to the Free Software Foundation for developing the GNU Free Documentation License, which helped make my collaboration with Jeff and Chris possible, and Creative Commons for the license I am using now.

感谢自由软件基金会开发了 GNU 自由文档许可证,它促成了我与 Jeff 和 Chris 的合作;也感谢知识共享(Creative Commons)提供了我现在使用的许可证。

Thanks to the editors at Lulu who worked on How to Think Like a Computer Scientist.

感谢 Lulu 的编辑们,他们参与了《如何像计算机科学家一样思考》的出版工作。

Thanks to all the students who worked with earlier versions of this book and all the contributors (listed below) who sent in corrections and suggestions.

感谢所有使用过本书早期版本的学生,以及所有(列于下方)发来更正与建议的贡献者。

Contributor List 贡献者名单

More than 100 sharp-eyed and thoughtful readers have sent in suggestions and corrections over the past few years. Their contributions, and enthusiasm for this project, have been a huge help.

过去几年里,一百多位目光敏锐、心思缜密的读者发来了建议和更正。他们的贡献,以及对这个项目的热情,给予了巨大的帮助。

If you have a suggestion or correction, please send email to [email protected]. If I make a change based on your feedback, I will add you to the contributor list (unless you ask to be omitted).

如果你有建议或更正,请发邮件到 [email protected]。如果我根据你的反馈做了修改,我会把你加入贡献者名单(除非你要求略去)。

If you include at least part of the sentence the error appears in, that makes it easy for me to search. Page and section numbers are fine, too, but not quite as easy to work with. Thanks!

如果你能附上出错所在的句子至少一部分,我就能很方便地检索。页码和章节号也可以,但用起来没那么顺手。谢谢!