Page 14 - think python 2
P. 14

xiv Contents
 3 Functions
17
3.1 Functioncalls ................................... 17
3.2 Mathfunctions................................... 18
3.3 Composition.................................... 19
3.4 Addingnewfunctions .............................. 19
3.5 Definitionsanduses ............................... 20
3.6 Flowofexecution................................. 21
3.7 Parametersandarguments............................ 21
3.8 Variablesandparametersarelocal ....................... 22
3.9 Stackdiagrams .................................. 23
3.10 Fruitfulfunctionsandvoidfunctions...................... 24
3.11 Whyfunctions? .................................. 24
3.12 Debugging..................................... 25
3.13 Glossary ...................................... 25
3.14 Exercises ...................................... 26
4 Case study: interface design 29
4.1 Theturtlemodule................................. 29
4.2 Simplerepetition ................................. 30
4.3 Exercises ...................................... 31
4.4 Encapsulation ................................... 32
4.5 Generalization................................... 32
4.6 Interfacedesign .................................. 33
4.7 Refactoring..................................... 34
4.8 Adevelopmentplan ............................... 35
4.9 docstring...................................... 35
4.10 Debugging..................................... 36
4.11 Glossary ...................................... 36
4.12 Exercises ...................................... 37





































































   12   13   14   15   16