Python Cookbook

Front Cover
Alex Martelli, David Ascher
"O'Reilly Media, Inc.", 2002 - Computers - 574 pages

ThePython Cookbookis a collection of problems, solutions, and practical examples for Python programmers, written by Python programmers. Over the past year, members of the Python community have contributed material to an online repository of Python recipes hosted by ActiveState. This book contains the best of those recipes, accompanied by overviews and background material by key Python figures.

The recipes in thePython Cookbookrange from simple tasks, such as working with dictionaries and list comprehensions, to entire modules that demonstrate templating systems and network monitoring. This book contains over 200 recipes on the following topics:

  • Searching and sorting
  • Manipulating text
  • Working with files and the filesystem
  • Object-oriented programming
  • Dealing with threads and processes
  • System administration
  • Interacting with databases
  • Creating user interfaces
  • Network and web programming
  • Processing XML
  • Distributed programming
  • Debugging and testing
  • Extending Python

This book is a treasure trove of useful code for all Python programmers, from novices to advanced practitioners, with contributions from such Python luminaries as Guido Van Rossum, David Ascher, Tim Peters, Paul Prescod, Mark Hammond, and Alex Martelli, as well as over 100 other Python programmers. The recipes highlight Python best practices and can be used directly in day-to-day programming tasks, as a source of ideas, or as a way to learn more about Python.

The recipes in thePython Cookbookwere edited by David Ascher, who is on the board of the Python Software Foundation and is the co-author ofLearning Python,and Alex Martelli, who is known for his numerous and exhaustive postings on the Python mailing list. The book contains a foreword by Guido van Rossum, the creator of Python.

 

What people are saying - Write a review

User ratings

5 stars
5
4 stars
8
3 stars
0
2 stars
3
1 star
0

LibraryThing Review

User Review  - wyclif - LibraryThing

I'm glad to be done with this for now, as I am with most books intended for reference use that I try reading cover to cover. Nevertheless it's a great resource, and I think the recipes here are a bit ... Read full review

LibraryThing Review

User Review  - jcrben - LibraryThing

Even though it's intended for experienced developers, it helped me understand some of the tricky issues that I was running into just starting out. Read full review

Contents

I
v
II
xiii
III
xvii
IV
1
VI
3
VII
4
VIII
6
IX
7
CXL
260
CXLI
262
CXLII
264
CXLIV
267
CXLV
269
CXLVI
272
CXLVII
275
CXLVIII
276

X
8
XI
11
XII
13
XIII
15
XIV
18
XV
20
XVI
21
XVII
23
XVIII
25
XIX
27
XX
28
XXI
30
XXII
31
XXIII
34
XXIV
38
XXV
40
XXVI
42
XXVII
43
XXVIII
46
XXIX
47
XXX
49
XXXI
52
XXXII
54
XXXIII
57
XXXIV
59
XXXV
61
XXXVI
63
XXXVII
69
XXXVIII
70
XXXIX
71
XLI
72
XLII
74
XLIII
76
XLIV
78
XLV
79
XLVI
81
XLVII
83
XLVIII
85
XLIX
86
L
88
LI
91
LII
93
LIII
94
LIV
96
LV
97
LVI
99
LVII
100
LVIII
104
LIX
109
LX
113
LXI
117
LXII
119
LXIV
121
LXV
122
LXVI
123
LXVII
125
LXVIII
127
LXIX
129
LXX
132
LXXI
134
LXXII
135
LXXIII
137
LXXV
138
LXXVI
140
LXXVII
141
LXXVIII
143
LXXIX
144
LXXX
145
LXXXI
146
LXXXII
147
LXXXIII
148
LXXXIV
150
LXXXV
152
LXXXVI
154
LXXXVII
156
LXXXVIII
160
LXXXIX
165
XC
167
XCI
169
XCIII
172
XCIV
174
XCV
176
XCVI
177
XCVII
179
XCVIII
182
XCIX
183
C
186
CI
188
CII
189
CIII
191
CIV
193
CV
194
CVI
198
CVII
201
CVIII
202
CIX
203
CX
206
CXI
208
CXII
211
CXIII
214
CXV
217
CXVI
218
CXVII
220
CXVIII
222
CXIX
225
CXX
227
CXXI
229
CXXII
231
CXXIII
233
CXXIV
236
CXXVI
237
CXXVII
238
CXXVIII
240
CXXIX
242
CXXX
243
CXXXI
245
CXXXII
246
CXXXIII
248
CXXXIV
250
CXXXV
253
CXXXVI
254
CXXXVII
255
CXXXVIII
257
CXXXIX
258
CXLIX
278
CL
279
CLI
281
CLII
283
CLIII
285
CLIV
288
CLV
291
CLVI
298
CLVIII
300
CLIX
301
CLX
303
CLXI
304
CLXII
307
CLXIII
308
CLXIV
311
CLXV
313
CLXVI
315
CLXVII
317
CLXVIII
318
CLXIX
322
CLXX
326
CLXXI
328
CLXXII
330
CLXXIII
331
CLXXIV
333
CLXXV
334
CLXXVI
336
CLXXVII
337
CLXXVIII
338
CLXXIX
340
CLXXX
342
CLXXXI
344
CLXXXII
346
CLXXXIII
350
CLXXXIV
353
CLXXXV
356
CLXXXVI
357
CLXXXVII
359
CLXXXVIII
361
CLXXXIX
362
CXC
364
CXCI
366
CXCII
368
CXCIII
369
CXCIV
372
CXCV
374
CXCVI
377
CXCVIII
379
CXCIX
380
CC
382
CCI
383
CCII
384
CCIII
385
CCIV
387
CCV
389
CCVI
390
CCVII
393
CCVIII
395
CCIX
398
CCX
402
CCXI
404
CCXII
405
CCXIII
407
CCXIV
409
CCXV
412
CCXVI
414
CCXVII
417
CCXVIII
420
CCXIX
423
CCXXI
424
CCXXII
425
CCXXIII
428
CCXXIV
429
CCXXV
432
CCXXVI
434
CCXXVII
437
CCXXVIII
440
CCXXIX
444
CCXXX
449
CCXXXI
452
CCXXXII
454
CCXXXIII
455
CCXXXIV
457
CCXXXV
460
CCXXXVI
461
CCXXXVII
463
CCXXXVIII
465
CCXXXIX
467
CCXL
469
CCXLI
471
CCXLII
475
CCXLIII
477
CCXLIV
481
CCXLV
485
CCXLVI
488
CCXLVII
489
CCXLVIII
491
CCXLIX
494
CCL
496
CCLI
497
CCLII
499
CCLIII
503
CCLIV
506
CCLV
507
CCLVI
509
CCLVII
513
CCLVIII
515
CCLIX
517
CCLX
519
CCLXI
521
CCLXII
522
CCLXIII
524
CCLXIV
526
CCLXV
529
CCLXVI
530
CCLXVII
532
CCLXVIII
533
CCLXIX
535
CCLXX
536
CCLXXI
539
CCLXXII
547
CCLXXIII
551
Copyright

Common terms and phrases

About the author (2002)

Alex Martelli spent 8 years with IBM Research, winning three Outstanding Technical Achievement Awards. He then spent 13 as a Senior Software Consultant at think3 inc, developing libraries, network protocols, GUI engines, event frameworks, and web access frontends. He has also taught programming languages, development methods, and numerical computing at Ferrara University and other venues. He's a C++ MVP for Brainbench, and a member of the Python Software Foundation. He currently works for AB Strakt, a Python-centered software house in Gteborg, Sweden, mostly by telecommuting from his home in Bologna, Italy. Alex's proudest achievement is the articles that appeared in Bridge World (January/February 2000), which were hailed as giant steps towards solving issues that had haunted contract bridge theoreticians for decades.

David Ascher is the lead for Python projects at ActiveState, including Komodo, ActiveState's integrated development environment written mostly in Python. David has taught courses about Python to corporations, in universities, and at conferences. He also organized the Python track at the 1999 and 2000 O'Reilly Open Source Conventions, and was the program chair for the 10th International Python Conference. In addition, he co-wrote Learning Python (both editions) and serves as a director of the Python Software Foundation. David holds a B.S. in physics and a Ph.D. in cognitive science, both from Brown University.

Bibliographic information