diveintopython.pdf


Preview of PDF document diveintopython.pdf

Page 1 2 3 456327

Text preview


Table of Contents
Chapter 16. Functional Programming.......................................................................................................................223
16.1. Diving in..................................................................................................................................................223
16.2. Finding the path.......................................................................................................................................224
16.3. Filtering lists revisited..............................................................................................................................226
16.4. Mapping lists revisited.............................................................................................................................228
16.5. Data−centric programming......................................................................................................................229
16.6. Dynamically importing modules..............................................................................................................230
16.7. Putting it all together................................................................................................................................231
16.8. Summary..................................................................................................................................................234
Chapter 17. Dynamic functions..................................................................................................................................235
17.1. Diving in..................................................................................................................................................235
17.2. plural.py, stage 1......................................................................................................................................235
17.3. plural.py, stage 2......................................................................................................................................237
17.4. plural.py, stage 3......................................................................................................................................239
17.5. plural.py, stage 4......................................................................................................................................240
17.6. plural.py, stage 5......................................................................................................................................242
17.7. plural.py, stage 6......................................................................................................................................243
17.8. Summary..................................................................................................................................................246
Chapter 18. Performance Tuning...............................................................................................................................247
18.1. Diving in..................................................................................................................................................247
18.2. Using the timeit Module..........................................................................................................................249
18.3. Optimizing Regular Expressions.............................................................................................................250
18.4. Optimizing Dictionary Lookups..............................................................................................................253
18.5. Optimizing List Operations......................................................................................................................256
18.6. Optimizing String Manipulation..............................................................................................................258
18.7. Summary..................................................................................................................................................260
Appendix A. Further reading.....................................................................................................................................261
Appendix B. A 5−minute review.................................................................................................................................268
Appendix C. Tips and tricks.......................................................................................................................................282
Appendix D. List of examples.....................................................................................................................................289
Appendix E. Revision history......................................................................................................................................302
Appendix F. About the book.......................................................................................................................................314
Appendix G. GNU Free Documentation License......................................................................................................315
G.0. Preamble....................................................................................................................................................315
G.1. Applicability and definitions.....................................................................................................................315
G.2. Verbatim copying......................................................................................................................................316
G.3. Copying in quantity...................................................................................................................................316
G.4. Modifications............................................................................................................................................317
G.5. Combining documents..............................................................................................................................318
G.6. Collections of documents..........................................................................................................................318
G.7. Aggregation with independent works.......................................................................................................318
Dive Into Python

iv