머리말

이 책의 기묘한 역사

1999년 1월에 저는 자바(Java)로 프로그래밍 입문 강의를 준비하고 있었습니다. 이미 세 번 가르쳤고, 저는 혼란에 빠져있었습니다. 수업의 실패율이 너무 높고, 성공한 학생들조차 전체적인 성취 수준이 너무 낮았습니다.

제가 발견한 한가지 문제점은 책이었습니다. 자바에 관한 불필요한 세부사항들을 너무 많이 담아서 책이 너무 두꺼웠고, 어떻게 프로그래밍 해야 하는지에 대한 고수준의 지도는 부족했습니다. 그리고 모두 함정 효과가 있었습니다: 쉽게 시작한 후, 천천히 진행하다가, 5장 근처의 어디쯤에서 바닥이 무너져 내립니다. 학생들에게 너무 많은 새로운 것들이 너무 빨리 제시되고, 저는 남은 학기를 부스러기라도 주우며 보내게 됩니다.

수업 시작 두 주전에, 저는 제 책을 쓰기로 결심했습니다. 제 목표는 이러했습니다:

  • 짧게 유지해라. 학생들에게는 읽지 않는 50쪽 보다는 읽는 10 쪽이 더 좋다.
  • 단어 선택에 신중 하라. 전문 용어를 최소화하고 처음 사용할 때 각 용어를 정의하려고 했습니다.
  • 차곡차곡 쌓아라. 함정을 피하기 위해, 저는 가장 어려운 주제들을 일련의 작은 단계들로 쪼갰습니다.
  • 프로그래밍 언어가 아니라, 프로그래밍에 초점을 맞춰라. 저는 자바에서 최소한의 유용한 부분만 포함시키고 나머지들을 제외시켰습니다.

저는 제목이 필요했고, 즉흥적으로 How to Think Like a Computer Scientist 를 선택했습니다.

제 첫 번째 버전은 거칠었지만, 제 역할을 했습니다. 학생들은 읽었고, 제가 수업 시간을 어려운 주제, 흥미로운 주제, (가장 중요한) 학생들을 연습시키는데 쓸 수 있을 만큼 충분히 이해했습니다.

저는 그 책을 GNU Free Documentation License 로 내놓았는데, 사용자들이 책을 복사, 수정, 배포할 수 있도록 허락합니다.

다음에 일어난 일이 쿨한 부분입니다. 버지니아의 고등학교 교사인 Jeff Elkner 가 제 책을 도입하고 파이썬으로 번역했습니다. 그는 제게 번역의 사본을 보냈고, 저는 제 책을 읽음으로써 파이썬을 배우는 특별한 경험을 했습니다. Green Tea Press 에서, 저는 첫 번째 파이썬 버전을 2001년에 출판했습니다.

2003년에 저는 Olin 대학에서 가르치기 시작했고 처음으로 파이썬을 강의했습니다. 자바와의 차이는 현저했습니다. 학생들은 덜 고생하고, 더 많이 배우며, 더 흥미로운 프로젝트들을 수행하고, 일반적으로 더 많은 재미를 느낍니다.

지난 구 년 동안 저는 오류를 바로잡고, 예제들을 개선하고, 내용, 특히 연습문제들을 추가하면서 책을 개선해왔습니다.

그 결과가 이 책인데, 이제는 덜 뽐내는 제목 Think Python 을 달고 있습니다. 이런 변경들이 가해졌습니다:

  • 각 장의 끝에 디버깅에 관한 절을 추가했습니다. 이 절들은 버그를 발견하고 피하는 일반적인 기술들과 파이썬의 함정들에 대한 경고를 소개합니다.
  • 더 많은 연습문제들을 추가했는데, 간단한 이해도 검사에서 몇몇 실제적인 프로젝트에 이릅니다. 그리고 그 것들 대부분의 해답을 작성했습니다.
  • 일련의 사례 연구를 추가했는데, 연습문제와 해답과 토론을 담은 더 긴 예제 입니다. 어떤 것들은 수업에 쓰기 위해 제가 작성한 파이썬 프로그램 모음인 Swampy 에 기반합니다. Swampy 와 코드 예제들과 몇몇 해답들은 http://thinkpython.com에 있습니다.
  • 프로그램 개발 계획과 기초적인 디자인 패턴들에 대한 논의를 확장했습니다.
  • 디버깅, 알고리즘 분석, Lumpy 를 사용한 UML 다이어그램에 대한 부록을 추가했습니다.

이 책으로 즐겁게 공부하고, 그 것이 여러분들이 프로그램 하는 법을 배우고 (적어도 약간은) 컴퓨터 과학자처럼 생각하도록 도울 수 있기를 바랍니다.

Allen B. Downey
Needham MA

Allen Downey 는 Franklin W. Olin College of Engineering 의 Computer Science 교수입니다.

감사의 글

제 책을 파이썬으로 번역해서 이 프로젝트가 시작되도록 만들고, 가장 좋아하는 언어가 된 것을 소개해준 Jeff Elkner 에게 감사 드립니다.

How to Think Like a Computer Scientist 에 여러 절을 기여한 Chris Meyers 에게도 또한 감사 드립니다.

Jeff 와 Chris 와의 협업을 가능하게 만들어준 GNU Free Documentation License 를 개발한 Free Software Foundation 과, 제가 지금 사용중인 라이선스인 Creative Commons 에 감사 드립니다.

How to Think Like a Computer Scientist 를 작업한 Lulu 의 편집자들께 감사 드립니다.

이 책의 초기 버전들로 공부한 모든 학생들과 교정과 제안을 보내온 (아래에 나열된) 모든 기여자들에게 감사 드립니다.

기여자 목록

100명 이상의 날카로운 눈을 가진 사려 깊은 독자들이 지난 몇 년 동안 제안과 교정을 보내왔습니다. 그들의 기여와 이 프로젝트에 대한 열의는 큰 도움이 됐습니다.

제안이나 교정을 가진 분들은 feedback@thinkpython.com 로 메일을 보내주시기 바랍니다. 여러분의 피드백에 따라 수정한다면, (여러분이 빼주도록 요청하지 않는다면) 기여자 목록에 넣어드리겠습니다.

오류가 등장한 구절의 적어도 일부를 포함시킨다면, 제가 찾기 쉽습니다. 쪽수와 절 번호도 좋지만 그리 쉽지는 않습니다. 감사합니다!

  • Lloyd Hugh Allen sent in a correction to Section 8.4.
  • Yvon Boulianne sent in a correction of a semantic error in Chapter 5.
  • Fred Bremmer submitted a correction in Section 2.1.
  • Jonah Cohen wrote the Perl scripts to convert the LaTeX source for this book into beautiful HTML.
  • Michael Conlon sent in a grammar correction in Chapter 2 and an improvement in style in Chapter 1, and he initiated discussion on the technical aspects of interpreters.
  • Benoit Girard sent in a correction to a humorous mistake in Section 5.6.
  • Courtney Gleason and Katherine Smith wrote horsebet.py, which was used as a case study in an earlier version of the book. Their program can now be found on the website.
  • Lee Harr submitted more corrections than we have room to list here, and indeed he should be listed as one of the principal editors of the text.
  • James Kaylin is a student using the text. He has submitted numerous corrections.
  • David Kershaw fixed the broken catTwice function in Section 3.10.
  • Eddie Lam has sent in numerous corrections to Chapters 1, 2, and 3. He also fixed the Makefile so that it creates an index the first time it is run and helped us set up a versioning scheme.
  • Man-Yong Lee sent in a correction to the example code in Section 2.4.
  • David Mayo pointed out that the word “unconsciously" in Chapter 1 needed to be changed to “subconsciously".
  • Chris McAloon sent in several corrections to Sections 3.9 and 3.10.
  • Matthew J. Moelter has been a long-time contributor who sent in numerous corrections and suggestions to the book.
  • Simon Dicon Montford reported a missing function definition and several typos in Chapter 3. He also found errors in the increment function in Chapter 13.
  • John Ouzts corrected the definition of “return value" in Chapter 3.
  • Kevin Parks sent in valuable comments and suggestions as to how to improve the distribution of the book.
  • David Pool sent in a typo in the glossary of Chapter 1, as well as kind words of encouragement.
  • Michael Schmitt sent in a correction to the chapter on files and exceptions.
  • Robin Shaw pointed out an error in Section 13.1, where the printTime function was used in an example without being defined.
  • Paul Sleigh found an error in Chapter 7 and a bug in Jonah Cohen’s Perl script that generates HTML from LaTeX.
  • Craig T. Snydal is testing the text in a course at Drew University. He has contributed several valuable suggestions and corrections.
  • Ian Thomas and his students are using the text in a programming course. They are the first ones to test the chapters in the latter half of the book, and they have made numerous corrections and suggestions.
  • Keith Verheyden sent in a correction in Chapter 3.
  • Peter Winstanley let us know about a longstanding error in our Latin in Chapter 3.
  • Chris Wrobel made corrections to the code in the chapter on file I/O and exceptions.
  • Moshe Zadka has made invaluable contributions to this project. In addition to writing the first draft of the chapter on Dictionaries, he provided continual guidance in the early stages of the book.
  • Christoph Zwerschke sent several corrections and pedagogic suggestions, and explained the difference between gleich and selbe.
  • James Mayer sent us a whole slew of spelling and typographical errors, including two in the contributor list.
  • Hayden McAfee caught a potentially confusing inconsistency between two examples.
  • Angel Arnal is part of an international team of translators working on the Spanish version of the text. He has also found several errors in the English version.
  • Tauhidul Hoque and Lex Berezhny created the illustrations in Chapter 1 and improved many of the other illustrations.
  • Dr. Michele Alzetta caught an error in Chapter 8 and sent some interesting pedagogic comments and suggestions about Fibonacci and Old Maid.
  • Andy Mitchell caught a typo in Chapter 1 and a broken example in Chapter 2.
  • Kalin Harvey suggested a clarification in Chapter 7 and caught some typos.
  • Christopher P. Smith caught several typos and helped us update the book for Python 2.2.
  • David Hutchins caught a typo in the Foreword.
  • Gregor Lingl is teaching Python at a high school in Vienna, Austria. He is working on a German translation of the book, and he caught a couple of bad errors in Chapter 5.
  • Julie Peters caught a typo in the Preface.
  • Florin Oprina sent in an improvement in makeTime, a correction in printTime, and a nice typo.
  • D. J. Webre suggested a clarification in Chapter 3.
  • Ken found a fistful of errors in Chapters 8, 9 and 11.
  • Ivo Wever caught a typo in Chapter 5 and suggested a clarification in Chapter 3.
  • Curtis Yanko suggested a clarification in Chapter 2.
  • Ben Logan sent in a number of typos and problems with translating the book into HTML.
  • Jason Armstrong saw the missing word in Chapter 2.
  • Louis Cordier noticed a spot in Chapter 16 where the code didn’t match the text.
  • Brian Cain suggested several clarifications in Chapters 2 and 3.
  • Rob Black sent in a passel of corrections, including some changes for Python 2.2.
  • Jean-Philippe Rey at Ecole Centrale Paris sent a number of patches, including some updates for Python 2.2 and other thoughtful improvements.
  • Jason Mader at George Washington University made a number of useful suggestions and corrections.
  • Jan Gundtofte-Bruun reminded us that “a error” is an error.
  • Abel David and Alexis Dinno reminded us that the plural of “matrix” is “matrices”, not “matrixes”. This error was in the book for years, but two readers with the same initials reported it on the same day. Weird.
  • Charles Thayer encouraged us to get rid of the semi-colons we had put at the ends of some statements and to clean up our use of “argument” and “parameter”.
  • Roger Sperberg pointed out a twisted piece of logic in Chapter 3.
  • Sam Bull pointed out a confusing paragraph in Chapter 2.
  • Andrew Cheung pointed out two instances of “use before def.”
  • C. Corey Capel spotted the missing word in the Third Theorem of Debugging and a typo in Chapter 4.
  • Alessandra helped clear up some Turtle confusion.
  • Wim Champagne found a brain-o in a dictionary example.
  • Douglas Wright pointed out a problem with floor division in arc.
  • Jared Spindor found some jetsam at the end of a sentence.
  • Lin Peiheng sent a number of very helpful suggestions.
  • Ray Hagtvedt sent in two errors and a not-quite-error.
  • Torsten Hübsch pointed out an inconsistency in Swampy.
  • Inga Petuhhov corrected an example in Chapter 14.
  • Arne Babenhauserheide sent several helpful corrections.
  • Mark E. Casida is is good at spotting repeated words.
  • Scott Tyler filled in a that was missing. And then sent in a heap of corrections.
  • Gordon Shephard sent in several corrections, all in separate emails.
  • Andrew Turner spotted an error in Chapter 8.
  • Adam Hobart fixed a problem with floor division in arc.
  • Daryl Hammond and Sarah Zimmerman pointed out that I served up math.pi too early. And Zim spotted a typo.
  • George Sass found a bug in a Debugging section.
  • Brian Bingham suggested Exercise [exrotatepairs].
  • Leah Engelbert-Fenton pointed out that I used tuple as a variable name, contrary to my own advice. And then found a bunch of typos and a “use before def.”
  • Joe Funke spotted a typo.
  • Chao-chao Chen found an inconsistency in the Fibonacci example.
  • Jeff Paine knows the difference between space and spam.
  • Lubos Pintes sent in a typo.
  • Gregg Lind and Abigail Heithoff suggested Exercise [checksum].
  • Max Hailperin has sent in a number of corrections and suggestions. Max is one of the authors of the extraordinary Concrete Abstractions, which you might want to read when you are done with this book.
  • Chotipat Pornavalai found an error in an error message.
  • Stanislaw Antol sent a list of very helpful suggestions.
  • Eric Pashman sent a number of corrections for Chapters 4–11.
  • Miguel Azevedo found some typos.
  • Jianhua Liu sent in a long list of corrections.
  • Nick King found a missing word.
  • Martin Zuther sent a long list of suggestions.
  • Adam Zimmerman found an inconsistency in my instance of an “instance” and several other errors.
  • Ratnakar Tiwari suggested a footnote explaining degenerate triangles.
  • Anurag Goel suggested another solution for is_abecedarian and sent some additional corrections. And he knows how to spell Jane Austen.
  • Kelli Kratzer spotted one of the typos.
  • Mark Griffiths pointed out a confusing example in Chapter 3.
  • Roydan Ongie found an error in my Newton’s method.
  • Patryk Wolowiec helped me with a problem in the HTML version.
  • Mark Chonofsky told me about a new keyword in Python 3.
  • Russell Coleman helped me with my geometry.
  • Wei Huang spotted several typographical errors.
  • Karen Barber spotted the the oldest typo in the book.
  • Nam Nguyen found a typo and pointed out that I used the Decorator pattern but didn’t mention it by name.
  • Stéphane Morin sent in several corrections and suggestions.
  • Paul Stoop corrected a typo in uses_only.
  • Eric Bronner pointed out a confusion in the discussion of the order of operations.
  • Alexandros Gezerlis set a new standard for the number and quality of suggestions he submitted. We are deeply grateful!
  • Gray Thomas knows his right from his left.
  • Giovanni Escobar Sosa sent a long list of corrections and suggestions.
  • Alix Etienne fixed one of the URLs.
  • Kuang He found a typo.
  • Daniel Neilson corrected an error about the order of operations.
  • Will McGinnis pointed out that polyline was defined differently in two places.
  • Swarup Sahoo spotted a missing semi-colon.
  • Frank Hecker pointed out an exercise that was under-specified, and some broken links.
  • Animesh B helped me clean up a confusing example.
  • Martin Caspersen found two round-off errors.
  • Gregor Ulm sent several corrections and suggestions.
  • Dimitrios Tsirigkas suggested I clarify an exercise.
  • Carlos Tafur sent a page of corrections and suggestions.
  • Martin Nordsletten found a bug in an exercise solution.
  • Lars O.D. Christensen found a broken reference.
  • Victor Simeone found a typo.
  • Sven Hoexter pointed out that a variable named input shadows a build-in function.
  • Viet Le found a typo.
  • Stephen Gregory pointed out the problem with cmp in Python 3.
  • Matthew Shultz let me know about a broken link.