|
32 | 32 | \title{Think Python} |
33 | 33 | \author{Allen B. Downey} |
34 | 34 | \newcommand{\thetitle}{Think Python: How to Think Like a Computer Scientist} |
35 | | -\newcommand{\theversion}{2nd Edition, Version 2.2.19} |
| 35 | +\newcommand{\theversion}{2nd Edition, Version 2.2.20} |
36 | 36 | \newcommand{\thedate}{} |
37 | 37 |
|
38 | 38 | % these styles get translated in CSS for the HTML version |
@@ -716,6 +716,8 @@ \section*{Contributor List} |
716 | 716 | \item Xavier Van Aubel made several useful corrections in the second |
717 | 717 | edition. |
718 | 718 |
|
| 719 | +\item William Murray corrected my definition of floor division. |
| 720 | + |
719 | 721 | % ENDCONTRIB |
720 | 722 |
|
721 | 723 | In addition, people who spotted typos or made corrections include |
@@ -2430,6 +2432,8 @@ \section{Stack diagrams} |
2430 | 2432 | you create a variable outside of any function, it belongs to |
2431 | 2433 | \verb"__main__". |
2432 | 2434 |
|
| 2435 | +\index{main} |
| 2436 | + |
2433 | 2437 | Each parameter refers to the same value as its corresponding |
2434 | 2438 | argument. So, {\tt part1} has the same value as |
2435 | 2439 | {\tt line1}, {\tt part2} has the same value as {\tt line2}, |
@@ -3927,6 +3931,7 @@ \section{Recursion} |
3927 | 3931 |
|
3928 | 3932 | And then you're back in \verb"__main__". So, the |
3929 | 3933 | total output looks like this: |
| 3934 | +\index{main} |
3930 | 3935 |
|
3931 | 3936 | \begin{verbatim} |
3932 | 3937 | 3 |
@@ -4208,7 +4213,7 @@ \section{Glossary} |
4208 | 4213 | \begin{description} |
4209 | 4214 |
|
4210 | 4215 | \item[floor division:] An operator, denoted {\tt //}, that divides two |
4211 | | - numbers and rounds down (toward zero) to an integer. |
| 4216 | + numbers and rounds down (toward negative infinity) to an integer. |
4212 | 4217 | \index{floor division} |
4213 | 4218 | \index{division!floor} |
4214 | 4219 |
|
@@ -9125,6 +9130,7 @@ \section{Global variables} |
9125 | 9130 | variables, which disappear when their function ends, global variables |
9126 | 9131 | persist from one function call to the next. |
9127 | 9132 | \index{flag} |
| 9133 | +\index{main} |
9128 | 9134 |
|
9129 | 9135 | It is common to use global variables for {\bf flags}; that is, |
9130 | 9136 | boolean variables that indicate (``flag'') whether a condition |
@@ -11887,6 +11893,9 @@ \section{Writing modules} |
11887 | 11893 | case, the test code runs. Otherwise, |
11888 | 11894 | if the module is being imported, the test code is skipped. |
11889 | 11895 |
|
| 11896 | +\index{name built-in variable} |
| 11897 | +\index{main} |
| 11898 | +
|
11890 | 11899 | As an exercise, type this example into a file named {\tt wc.py} and run |
11891 | 11900 | it as a script. Then run the Python interpreter and |
11892 | 11901 | {\tt import wc}. What is the value of \verb"__name__" |
|
0 commit comments