forked from bslatkin/effectivepython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
686 lines (539 loc) · 41.2 KB
/
index.html
File metadata and controls
686 lines (539 loc) · 41.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Effective Python › The Book</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<script type="text/javascript" src="//use.typekit.net/wsb2ykq.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
<link href="http://www.effectivepython.com/theme/css/bootstrap.min.css" rel="stylesheet" />
<link href="http://www.effectivepython.com/theme/css/customize.css" rel="stylesheet" />
<link rel="icon" type="image/png" href="http://www.effectivepython.com/images/favicon.png">
<meta name="description" content="Effective Python will prepare you to make a big impact with Python.">
<meta name="twitter:card" content="summary">
<meta name="twitter:creator" content="@EffectivePython">
<meta name="twitter:domain" content="effectivepython.com">
<meta name="twitter:title" content="Effective Python › The Book">
<meta name="twitter:description" content="Effective Python will prepare you to make a big impact with Python.">
<meta name="twitter:img:src" content="http://www.effectivepython.com/images/cover.jpg">
<meta property="og:title" content="Effective Python › The Book">
<meta property="og:description" content="Effective Python will prepare you to make a big impact with Python.">
<meta property="og:image" content="http://www.effectivepython.com/images/cover.jpg">
<meta property="og:url" content="http://www.effectivepython.com/">
<link href="http://www.effectivepython.com/atom.xml" type="application/atom+xml" rel="alternate" title="Effective Python Atom Feed" />
<meta name="google-site-verification" content="SxIULiiLHOaU206Ix5AbXU_9g_JiWZrdyKeI46XRfOA">
</head>
<body>
<div class="header">
<div class="container">
<div class="row">
<div class="col-md-6">
<h1 class="site-title"><a href="http://www.effectivepython.com/"><span class="effective-type">Effective</span> <span class="python-p-type">P</class><span class="python-rest-type">ython</span></a></h1>
</div>
</div>
</div>
</div>
</div>
<section id="the-book" class="content">
<div class="title-bar">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>The Book</h1>
</div>
</div>
</div>
</div>
<div class="page-content">
<div class="container">
<div class="row">
<div class="col-md-12">
</div>
</div>
</div>
</div>
</section>
<section id="preface" class="content">
<div class="page-content">
<div class="container">
<div class="row">
<div class="col-md-12">
<h2>Preface</h2>
<div>
<a href="http://amzn.to/1ylkKmc"><img src="http://www.effectivepython.com/images/cover.jpg" class="cover-photo" alt="Effective Python Book Cover"></a>
</div>
<p>The <a href="http://www.python.org">Python programming language</a> has unique strengths and charms that can be hard to grasp. Many programmers familiar with other languages often approach Python from a limited mindset instead of embracing its full expressivity. Some programmers go too far in the other direction, overusing Python features that can cause big problems later.</p>
<p><em>Effective Python</em> provides insight into the <em>Pythonic</em> way of writing programs: the best way to use Python. It builds on a fundamental understanding of the language that I assume you already have. Novice programmers will learn the best practices of Python’s capabilities. Experienced programmers will learn how to embrace the strangeness of a new tool with confidence.</p>
<p>My goal is to prepare you to make a big impact with Python.</p>
<h2>Now Available</h2>
<p>Print and digital editions of the book are now available! <em>Effective Python</em> was published by Addison-Wesley (an imprint of Pearson) on March 6th, 2015.</p>
<p><a target="_blank" href="http://amzn.to/1ylkKmc" class="btn btn-info btn-lg">Buy the Book</a>
<a target="_blank" href="http://click.linksynergy.com/link?id=YvEWtFaKGwg&offerid=145238.2235742&type=2&murl=http%3A%2F%2Fwww.informit.com%2Ftitle%2F9780134034423" class="btn btn-info btn-lg">Buy ePub / <span class="caps">PDF</span></a>
<a target="_blank" href="http://amzn.to/1AFwumA" class="btn btn-info btn-lg">Buy Kindle Edition</a></p>
<p><em>Also available in translations: <a href="http://www.amazon.co.jp/exec/obidos/ASIN/4873117569">日本語</a>, <a href="http://www.amazon.de/Effektiv-Python-programmieren-mitp-Professional/dp/3958451810">Deutsche</a>, <a href="https://www.amazon.cn/Effective-Python-%E7%BC%96%E5%86%99%E9%AB%98%E8%B4%A8%E9%87%8FPython%E4%BB%A3%E7%A0%81%E7%9A%8459%E4%B8%AA%E6%9C%89%E6%95%88%E6%96%B9%E6%B3%95-%E5%B8%83%E9%9B%B7%E7%89%B9%C2%B7%E6%96%AF%E6%8B%89%E7%89%B9%E9%87%91/dp/B01ASI36QS">简体中文</a>, <a href="http://books.gotop.com.tw/v_ACL043700">繁体中文</a>, <a href="http://helion.pl/ksiazki/efektywny-python-59-sposobow-na-lepszy-kod-brett-slatkin,efepyt.htm">Polszczyzna</a>, <a href="http://www.gilbut.co.kr/book/bookView.aspx?bookcode=BN001430">한국어</a>, <a href="http://novatec.com.br/livros/python-eficaz/">Português</a></em></p>
<h2>Already Have the Book?</h2>
<p><a href="https://github.com/bslatkin/effectivepython">Visit the GitHub project</a> to see all of the code snippets from the book in one place. Run and modify the example code yourself to confirm your understanding. You can also <a href="https://github.com/bslatkin/effectivepython/issues/new">report any errors</a> you’ve found or <a href="https://github.com/bslatkin/effectivepython/blob/master/Errata.md">view the list of corrections</a>.</p>
<p>For future updates about the book, related videos, translations, conference presentations, and more, choose one of these ways to stay in touch.</p>
<!-- Begin MailChimp Signup Form -->
<div id="mc_embed_signup">
<form action="//onebigfluke.us8.list-manage.com/subscribe/post?u=7e44598ae072a0e74d47a3073&id=09c55592e7" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate form-inline" target="_blank" novalidate>
<p>
<div class="mc-field-group input-group">
<div class="input-group-addon">@</div>
<input type="email" value="" name="EMAIL" class="required email form-control input-lg" id="mce-EMAIL" placeholder="Your email address">
</div>
<input type="submit" value="Get emailed" name="subscribe" id="mc-embedded-subscribe" class="btn btn-info btn-lg subscribe-button">
</p>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div>
<!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;"><input type="text" name="b_7e44598ae072a0e74d47a3073_09c55592e7" tabindex="-1" value=""></div>
</form>
</div>
<!--End mc_embed_signup-->
<div>
<a target="_blank" href="https://twitter.com/effectivepython" class="btn btn-info btn-lg">Follow @EffectivePython</a>
<a class="btn btn-info btn-lg" href="/atom.xml" onclick="(function(btn){var z=document.createElement('script');document.subtomeBtn=btn;z.src='https://www.subtome.com/load.js';document.body.appendChild(z);})(this); return false"><span class="caps">RSS</span></a>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="more-info" class="content">
<div class="title-bar">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>More Info</h1>
</div>
</div>
</div>
</div>
<div class="page-content">
<div class="container">
<div class="row">
<div class="col-md-12">
<h2>What This Book Covers</h2>
<p>Each chapter in <em>Effective Python</em> contains a broad but related set of items. You should jump between items and follow your interest. Each item contains concise and specific guidance explaining how you can write Python programs more effectively. Items include advice on what to do, what to avoid, how to strike the right balance, and why this is the best choice.</p>
<p>The items in this book are for Python 3 and Python 2 programmers alike. Programmers using alternative runtimes like Jython, IronPython, or PyPy should also find the majority of items to be applicable.</p>
<h3>Chapter 1: Pythonic Thinking</h3>
<p>The Python community has come to use the adjective Pythonic to describe code that follows a particular style. The idioms of Python have emerged over time through experience using the language and working with others. This chapter covers the best way to do the most common things in Python.</p>
<ol>
<li>Know Which Version of Python You’re Using</li>
<li>Follow the <span class="caps"><span class="caps">PEP</span></span> 8 Style Guide</li>
<li>Know the Differences Between <code>bytes</code>, <code>str</code>, and <code>unicode</code></li>
<li>Write Helper Functions Instead of Complex Expressions</li>
<li>Know How to Slice Sequences</li>
<li>Avoid Using <code>start</code>, <code>end</code>, and <code>stride</code> in a Single Slice</li>
<li>Use List Comprehensions Instead of <code>map</code> and <code>filter</code></li>
<li>Avoid More Than Two Expressions in List Comprehensions</li>
<li>Consider Generator Expressions for Large Comprehensions</li>
<li>Prefer <code>enumerate</code> Over range</li>
<li>Use <code>zip</code> to Process Iterators in Parallel</li>
<li>Avoid <code>else</code> Blocks After <code>for</code> and <code>while</code> Loops</li>
<li>Take Advantage of Each Block in <code>try</code>/<code>except</code>/<code>else</code>/<code>finally</code></li>
</ol>
<h3>Chapter 2: Functions</h3>
<p>Functions in Python have a variety of extra features that make a programmer’s life easier. Some are similar to capabilities in other programming languages, but many are unique to Python. This chapter covers how to use functions to clarify intention, promote reuse, and reduce bugs.</p>
<ol start="14">
<li>Prefer Exceptions to Returning <code>None</code></li>
<li>Know How Closures Interact with Variable Scope</li>
<li>Consider Generators Instead of Returning Lists</li>
<li>Be Defensive When Iterating Over Arguments</li>
<li>Reduce Visual Noise with Variable Positional Arguments</li>
<li>Provide Optional Behavior with Keyword Arguments</li>
<li>Use <code>None</code> and Docstrings to Specify Dynamic Default Arguments</li>
<li>Enforce Clarity with Keyword-Only Arguments</li>
</ol>
<h3>Chapter 3: Classes and Inheritance</h3>
<p>Python is an object-oriented language. Getting things done in Python often requires writing new classes and defining how they interact through their interfaces and hierarchies. This chapter covers how to use classes and inheritance to express your intended behaviors with objects.</p>
<ol start="22">
<li>Prefer Helper Classes Over Bookkeeping with Dictionaries and Tuples</li>
<li>Accept Functions for Simple Interfaces Instead of Classes</li>
<li>Use <code>@classmethod</code> Polymorphism to Construct Objects Generically</li>
<li>Initialize Parent Classes with <code>super</code></li>
<li>Use Multiple Inheritance Only for Mix-in Utility Classes</li>
<li>Prefer Public Attributes Over Private Ones</li>
<li>Inherit from <code>collections.abc</code> for Custom Container Types</li>
</ol>
<h3>Chapter 4: Metaclasses and Attributes</h3>
<p>Metaclasses and dynamic attributes are powerful Python features. However, they also enable you to implement extremely bizarre and unexpected behaviors. This chapter covers the common idioms for using these mechanisms to ensure that you follow the <em>rule of least surprise</em>.</p>
<ol start="29">
<li>Use Plain Attributes Instead of Get and Set Methods</li>
<li>Consider <code>@property</code> Instead of Refactoring Attributes</li>
<li>Use Descriptors for Reusable <code>@property</code> Methods</li>
<li>Use <code>__getattr__</code>, <code>__getattribute__</code>, and <code>__setattr__</code> for Lazy Attributes</li>
<li>Validate Subclasses with Metaclasses</li>
<li>Register Class Existence with Metaclasses</li>
<li>Annotate Class Attributes with Metaclasses</li>
</ol>
<h3>Chapter 5: Concurrency and Parallelism</h3>
<p>Python makes it easy to write concurrent programs that do many different things seemingly at the same time. Python can also be used to do parallel work through system calls, subprocesses, and C-extensions. This chapter covers how to best utilize Python in these subtly different situations.</p>
<ol start="36">
<li>Use <code>subprocess</code> to Manage Child Processes</li>
<li>Use Threads for Blocking I/O, Avoid for Parallelism</li>
<li>Use <code>Lock</code> to Prevent Data Races in Threads</li>
<li>Use <code>Queue</code> to Coordinate Work Between Threads</li>
<li>Consider Coroutines to Run Many Functions Concurrently</li>
<li>Consider <code>concurrent.futures</code> for True Parallelism</li>
</ol>
<h3>Chapter 6: Built-in Modules</h3>
<p>Python is installed with many of the important modules that you’ll need to write programs. These standard packages are so closely intertwined with idiomatic Python that they may as well be part of the language specification. This chapter covers the essential built-in modules.</p>
<ol start="42">
<li>Define Function Decorators with <code>functools.wraps</code></li>
<li>Consider <code>contextlib</code> and <code>with</code> Statements for Reusable <code>try</code>/<code>finally</code> Behavior</li>
<li>Make <code>pickle</code> Reliable with <code>copyreg</code></li>
<li>Use <code>datetime</code> Instead of <code>time</code> for Local Clocks</li>
<li>Use Built-in Algorithms and Data Structures</li>
<li>Use <code>decimal</code> When Precision is Paramount</li>
<li>Know Where to Find Community-Built Modules</li>
</ol>
<h3>Chapter 7: Collaboration</h3>
<p>Collaborating on Python programs requires you to be deliberate about how you write your code. Even if you’re working alone, you’ll want to understand how to use modules written by others. This chapter covers the standard tools and best practices that enable people to work together on Python programs.</p>
<ol start="49">
<li>Write Docstrings for Every Function, Class, and Module</li>
<li>Use Packages to Organize Modules and Provide Stable APIs</li>
<li>Define a Root <code>Exception</code> to Insulate Callers from APIs</li>
<li>Know How to Break Circular Dependencies</li>
<li>Use Virtual Environments for Isolated and Reproducible Dependencies</li>
</ol>
<h3>Chapter 8: Production</h3>
<p>Python has facilities for adapting to multiple deployment environments. It also has built-in modules that aid in hardening your programs and making them bulletproof. This chapter covers how to use Python to debug, optimize, and test your programs to maximize quality and performance at runtime.</p>
<ol start="54">
<li>Consider Module-Scoped Code to Configure Deployment Environments</li>
<li>Use <code>repr</code> Strings for Debugging Output</li>
<li>Test Everything with <code>unittest</code></li>
<li>Consider Interactive Debugging with <code>pdb</code></li>
<li>Profile Before Optimizing</li>
<li>Use <code>tracemalloc</code> to Understand Memory Usage and Leaks</li>
</ol>
</div>
</div>
</div>
</div>
</section>
<section id="about-the-author" class="content">
<div class="title-bar">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>About the Author</h1>
</div>
</div>
</div>
</div>
<div class="page-content">
<div class="container">
<div class="row">
<div class="col-md-12">
<h2>Brett Slatkin</h2>
<div>
<img class="about-photo" src="http://www.effectivepython.com/images/bslatkin_square.jpg" alt="Brett Slatkin">
</div>
<p>Brett is a Senior Staff Software Engineer at Google. He is the engineering lead and co-founder of <a href="https://www.google.com/insights/consumersurveys/home">Google Consumer Surveys</a>. He formerly worked on <a href="https://developers.google.com/appengine/">Google App Engine’s</a> Python infrastructure. He is the co-creator of the <a href="https://code.google.com/p/pubsubhubbub/">PubSubHubbub</a> protocol. Nine years ago he cut his teeth using Python to manage Google’s enormous fleet of servers.</p>
<p>Outside of his day job, he works on <a href="http://github.com/bslatkin">open source tools</a> and writes about software, bicycles, and other topics <a href="http://www.onebigfluke.com">on his personal website</a>. He earned his <span class="caps">B.S.</span> in Computer Engineering from Columbia University in the City of New York. He lives in San Francisco.</p>
<div class="clear-images">
<a target="_blank" href="https://twitter.com/haxor" class="btn btn-info btn-lg">Follow @haxor</a>
<a href="http://www.onebigfluke.com" class="btn btn-info btn-lg">Visit personal site</a>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="updates" class="content">
<div class="title-bar">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>Updates</h1>
</div>
</div>
</div>
</div>
<div class="page-content">
<div class="container">
<div class="row">
<div class="col-md-12">
</div>
</div>
</div>
</div>
</section>
<section id="posts" class="content">
<div class="container">
<div class="row hentry" id="python-eficaz-português">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2016/08/06/python-eficaz-português/">Python Eficaz</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2016-08-06T18:45:00-07:00">Sat 06 August 2016</abbr>
</div>
<div class="entry-content">
<p><a href="http://novatec.com.br/livros/python-eficaz/"><img class="learn-more-photo" alt="Python Eficaz" src="http://www.effectivepython.com/images/cover_pt_br.jpg"></a></p>
<p>The publishing house Novatec Editora has translated and released a Portuguese version of <em>Effective Python</em>. You can buy the book <a href="http://novatec.com.br/livros/python-eficaz/">directly from the publisher</a>.</p>
</div>
</div>
</div>
<div class="row hentry" id="effective-python-hans">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2016/05/07/effective-python-hans/">Effective Python 简体中文</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2016-05-07T09:00:00-07:00">Sat 07 May 2016</abbr>
</div>
<div class="entry-content">
<p><a href="https://www.amazon.cn/Effective-Python-%E7%BC%96%E5%86%99%E9%AB%98%E8%B4%A8%E9%87%8FPython%E4%BB%A3%E7%A0%81%E7%9A%8459%E4%B8%AA%E6%9C%89%E6%95%88%E6%96%B9%E6%B3%95-%E5%B8%83%E9%9B%B7%E7%89%B9%C2%B7%E6%96%AF%E6%8B%89%E7%89%B9%E9%87%91/dp/B01ASI36QS"><img class="learn-more-photo" alt="Effective Python 简体中文" src="http://www.effectivepython.com/images/cover_zh_hans.jpg"></a></p>
<p>The publishing house 机械工业出版社 (China Machine Press) has translated and released a Chinese (Simplified) version of <em>Effective Python</em>. You can buy the book <a href="http://www.cmpbook.com/stackroom.php?id=41800">directly from the publisher</a> or <a href="https://www.amazon.cn/Effective-Python-%E7%BC%96%E5%86%99%E9%AB%98%E8%B4%A8%E9%87%8FPython%E4%BB%A3%E7%A0%81%E7%9A%8459%E4%B8%AA%E6%9C%89%E6%95%88%E6%96%B9%E6%B3%95-%E5%B8%83%E9%9B%B7%E7%89%B9%C2%B7%E6%96%AF%E6%8B%89%E7%89%B9%E9%87%91/dp/B01ASI36QS">get it on Amazon.cn</a>.</p>
</div>
</div>
</div>
<div class="row hentry" id="effective-python-kr">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2016/04/03/effective-python-kr/">Effective Python 파이썬 코딩의 기술</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2016-04-03T17:00:00-07:00">Sun 03 April 2016</abbr>
</div>
<div class="entry-content">
<p><a href="http://www.gilbut.co.kr/book/bookView.aspx?bookcode=BN001430"><img class="learn-more-photo" alt="Effective Python 파이썬 코딩의 기술" src="http://www.effectivepython.com/images/cover_kr.jpg"></a></p>
<p>The publishing house Gilbut Inc. has translated and released a Korean version of <em>Effective Python</em>. <a href="http://www.gilbut.co.kr/book/bookView.aspx?bookcode=BN001430">The publisher’s website</a> links to many different retailers online where you can buy the book.</p>
</div>
</div>
</div>
<div class="row hentry" id="effective-python-jp">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2016/01/23/effective-python-jp/">Effective Python 日本語</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2016-01-23T09:00:00-08:00">Sat 23 January 2016</abbr>
</div>
<div class="entry-content">
<p><a href="http://www.amazon.co.jp/exec/obidos/ASIN/4873117569"><img class="learn-more-photo" alt="Effective Python 日本語" src="http://www.effectivepython.com/images/cover_jp.jpg"></a></p>
<p>The publishing house O’Reilly Japan has translated and released a Japanese version of <em>Effective Python</em>. You can buy the book <a href="http://www.oreilly.co.jp/books/9784873117560/">directly from the publisher</a> or <a href="http://www.amazon.co.jp/exec/obidos/ASIN/4873117569">get it on Amazon.jp</a>.</p>
</div>
</div>
</div>
<div class="row hentry" id="efektywny-python-pl">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2015/11/20/efektywny-python-pl/">Efektywny Python</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2015-11-20T09:00:00-08:00">Fri 20 November 2015</abbr>
</div>
<div class="entry-content">
<p><a href="http://helion.pl/ksiazki/efektywny-python-59-sposobow-na-lepszy-kod-brett-slatkin,efepyt.htm"><img class="learn-more-photo" alt="Efektywny Python" src="http://www.effectivepython.com/images/cover_pl.jpg"></a></p>
<p>The publishing house Helion has translated and released a Polish version of <em>Effective Python</em>. You can buy the book <a href="http://helion.pl/ksiazki/efektywny-python-59-sposobow-na-lepszy-kod-brett-slatkin,efepyt.htm">directly from the publisher</a>.</p>
</div>
</div>
</div>
<div class="row hentry" id="effektiv-python-deutsch">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2015/11/15/effektiv-python-deutsch/">Effektiv Python programmieren</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2015-11-15T21:40:00-08:00">Sun 15 November 2015</abbr>
</div>
<div class="entry-content">
<p><a href="http://www.amazon.de/Effektiv-Python-programmieren-mitp-Professional/dp/3958451810"><img class="learn-more-photo" alt="Effektiv Python programmieren" src="http://www.effectivepython.com/images/cover_de.jpg"></a></p>
<p>The publishing house mitp-Verlag has translated and released a German version of <em>Effective Python</em>. You can buy the book <a href="http://www.mitp.de/IT-Web/Programmierung/Effektiv-Python-programmieren.html">directly from the publisher</a> or <a href="http://www.amazon.de/Effektiv-Python-programmieren-mitp-Professional/dp/3958451810">get it on Amazon.de</a> (including Kindle edition).</p>
</div>
</div>
</div>
<div class="row hentry" id="talk-python-to-me-podcast">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2015/09/09/talk-python-to-me-podcast/">Talk Python To Me Podcast</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2015-09-09T09:00:00-07:00">Wed 09 September 2015</abbr>
</div>
<div class="entry-content">
<p>I was invited on to the <a href="https://talkpython.fm/episodes/show/25/effective-python">Talk Python To Me Podcast</a> to talk about <em>Effective Python</em>. You can <a href="https://talkpython.fm/episodes/transcript/25/effective-python">read the full transcript here</a> or listen to the audio embedded below. Thanks to Michael Kennedy for being such a welcoming host.</p>
<p><audio controls>
<source src="https://talkpython.fm/episodes/download/25/effective-python.mp3" type="audio/mpeg">
</audio></p>
</div>
</div>
</div>
<div class="row hentry" id="effective-python-cn">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2015/08/27/effective-python-cn/">Effective Python 中文版</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2015-08-27T09:00:00-07:00">Thu 27 August 2015</abbr>
</div>
<div class="entry-content">
<p><a href="http://books.gotop.com.tw/v_ACL043700"><img class="learn-more-photo" alt="Effective Python 中文版" src="http://www.effectivepython.com/images/cover_zh_hant.jpg"></a></p>
<p>The publishing house 碁峰 (Acer Peak) has translated and released a Chinese (Traditional) version of <em>Effective Python</em>. You can buy the book <a href="http://books.gotop.com.tw/v_ACL043700">directly from the publisher</a> or <a href="https://play.google.com/store/books/details/Brett_Slatkin_Effective_Python_%E4%B8%AD%E6%96%87%E7%89%88_%E5%AF%AB%E5%87%BA%E8%89%AF%E5%A5%BD_Python_%E7%A8%8B%E5%BC%8F%E7%9A%84?id=V2m7CgAAQBAJ">get a digital edition on Google Play</a>.</p>
</div>
</div>
</div>
<div class="row hentry" id="live-lessons-video">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2015/08/04/live-lessons-video/">Live Lessons Video</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2015-08-04T09:00:00-07:00">Tue 04 August 2015</abbr>
</div>
<div class="entry-content">
<p><a href="http://www.informit.com/store/effective-python-livelessons-video-training-downloadable-9780134175164"><img alt="Effective Python Live Lessons" class="learn-more-photo" src="http://www.effectivepython.com/images/live_lessons.png"></a></p>
<p>I worked with Addison-Wesley to produce a video version of the book <em>Effective Python</em>. You can view samples and buy the video <a href="http://www.informit.com/store/effective-python-livelessons-video-training-downloadable-9780134175164">on the publisher’s website</a>. </p>
<p>It includes 5 hours of video, covering 32 items from the book in six lessons. The content is primarily me using a source code editor to write Python programs that demonstrate the items from the book.</p>
</div>
</div>
</div>
<div class="row hentry" id="pycon-montreal">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2015/04/10/pycon-montreal/">Talk at PyCon Montréal</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2015-04-10T10:50:00-07:00">Fri 10 April 2015</abbr>
</div>
<div class="entry-content">
<p>I gave a talk at PyCon Montréal entitled “How to Be More Effective with Functions”.
<a class="read-more" href="http://www.effectivepython.com/2015/04/10/pycon-montreal/">Continue reading »</a>
</div>
</div>
</div>
<div class="row hentry" id="consider-coroutines-to-run-many-functions-concurrently">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2015/03/10/consider-coroutines-to-run-many-functions-concurrently/">Item 40: Consider Coroutines to Run Many Functions Concurrently</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2015-03-10T22:45:00-07:00">Tue 10 March 2015</abbr>
</div>
<div class="entry-content">
<p>Threads give Python programmers a way to run multiple functions seemingly at the same time. But there are three big problems with threads:
<a class="read-more" href="http://www.effectivepython.com/2015/03/10/consider-coroutines-to-run-many-functions-concurrently/">Continue reading »</a>
</div>
</div>
</div>
<div class="row hentry" id="books-is-published">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2015/03/06/books-is-published/">The Book Is Published</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2015-03-06T14:00:00-08:00">Fri 06 March 2015</abbr>
</div>
<div class="entry-content">
<p>Printed, physical copies of the <em>Effective Python</em> book are now for sale! <a href="http://goo.gl/mpVxz2">Follow this link to buy directly from the publisher</a> (free shipping in the <span class="caps">USA</span>). The publisher also has ePub and <span class="caps">PDF</span> versions available. <a href="http://amzn.to/1ylkKmc">Follow this link to buy from Amazon</a>. Amazon also has a Kindle edition available.</p>
</div>
</div>
</div>
<div class="row hentry" id="digital-editions-now-available">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2015/02/15/digital-editions-now-available/">Digital Editions Now Available</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2015-02-15T13:00:00-08:00">Sun 15 February 2015</abbr>
</div>
<div class="entry-content">
<p>Digital editions of <em>Effective Python</em> are now available. <a href="http://click.linksynergy.com/link?id=YvEWtFaKGwg&offerid=145238.2235742&type=2&murl=http%3A%2F%2Fwww.informit.com%2Ftitle%2F9780134034423">Follow this link to buy the ePub or <span class="caps">PDF</span> version</a>. <a href="http://amzn.to/1AFwumA">Follow this link to buy the Kindle edition</a>. The print copy is due out on March 6th.</p>
</div>
</div>
</div>
<div class="row hentry" id="accept-functions-for-simple-interfaces-instead-of-classes">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2015/02/12/accept-functions-for-simple-interfaces-instead-of-classes/">Item 23: Accept Functions for Simple Interfaces Instead of Classes</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2015-02-12T10:20:00-08:00">Thu 12 February 2015</abbr>
</div>
<div class="entry-content">
<p>Many of Python’s built-in APIs allow you to customize behavior by passing in a function. These <em>hooks</em> are used by APIs to call back your code while they execute.
<a class="read-more" href="http://www.effectivepython.com/2015/02/12/accept-functions-for-simple-interfaces-instead-of-classes/">Continue reading »</a>
</div>
</div>
</div>
<div class="row hentry" id="register-class-existence-with-metaclasses">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2015/02/02/register-class-existence-with-metaclasses/">Item 34: Register Class Existence with Metaclasses</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2015-02-02T22:22:00-08:00">Mon 02 February 2015</abbr>
</div>
<div class="entry-content">
<p>A common use of metaclasses is to automatically register types in your program. Registration is useful for doing reverse lookups, where you need to map a simple identifier back to a corresponding class.
<a class="read-more" href="http://www.effectivepython.com/2015/02/02/register-class-existence-with-metaclasses/">Continue reading »</a>
</div>
</div>
</div>
<div class="row hentry" id="use-virtual-environments-for-isolated-and-reproducible-dependencies">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2015/01/21/use-virtual-environments-for-isolated-and-reproducible-dependencies/">Item 53: Use Virtual Environments for Isolated and Reproducible <wbr>Dependencies</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2015-01-21T19:45:00-08:00">Wed 21 January 2015</abbr>
</div>
<div class="entry-content">
<p>Building larger and more complex programs often leads you to rely on various packages from the Python community. You’ll find yourself running <code>pip</code> to install packages like <code>pytz</code>, <code>numpy</code>, and many others.</p>
<p>The problem is that by default <code>pip</code> installs new packages in a global location. That causes all Python programs on your system to be affected by these installed modules. In theory, this shouldn’t be an issue. If you install a package and never <code>import</code> it, how could it affect your programs?
<a class="read-more" href="http://www.effectivepython.com/2015/01/21/use-virtual-environments-for-isolated-and-reproducible-dependencies/">Continue reading »</a>
</div>
</div>
</div>
<div class="row hentry" id="be-defensive-when-iterating-over-arguments">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2015/01/03/be-defensive-when-iterating-over-arguments/">Item 17: Be Defensive When Iterating Over Arguments</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2015-01-03T23:30:00-08:00">Sat 03 January 2015</abbr>
</div>
<div class="entry-content">
<p>When a function takes a list of objects as a parameter, it’s often important to iterate over that list multiple times.
<a class="read-more" href="http://www.effectivepython.com/2015/01/03/be-defensive-when-iterating-over-arguments/">Continue reading »</a>
</div>
</div>
</div>
<div class="row hentry" id="rough-cut-is-online">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2014/12/18/rough-cut-is-online/">The Rough Cut Is Online</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2014-12-18T19:15:00-08:00">Thu 18 December 2014</abbr>
</div>
<div class="entry-content">
<p>Can’t wait until next year for the book to be published? The rough cut is now <a href="http://safari.informit.com/9780134034416">available on Safari Books Online</a>. This is an early preview of the full content of the book before editing has been completed.</p>
</div>
</div>
</div>
<div class="row hentry" id="preorder-the-book">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2014/12/04/preorder-the-book/">Now Available for Preorder</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2014-12-04T23:45:00-08:00">Thu 04 December 2014</abbr>
</div>
<div class="entry-content">
<p><em>Effective Python</em> is now available for preorder on Amazon. <a href="http://amzn.to/1ylkKmc">Follow this link to buy your copy in advance</a>. It will ship in early 2015 once the book is published.</p>
</div>
</div>
</div>
<div class="row hentry" id="final-draft-done">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2014/11/16/final-draft-done/">Final Draft Done</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2014-11-16T00:30:00-08:00">Sun 16 November 2014</abbr>
</div>
<div class="entry-content">
<p>The final draft of the book is done. It’s 55,000 words, 250+ pages, 8 chapters, 59 items. Reviewers spent a lot of time looking over earlier drafts to ensure that the book will be useful. Now it’s off to production to be turned into a printable layout.</p>
</div>
</div>
</div>
<div class="row hentry" id="welcome-to-effective-python">
<div class="col-md-12">
<h2 class="entry-title"><a href="http://www.effectivepython.com/2014/08/18/welcome-to-effective-python/">Welcome</a></h2>
<div class="text-muted published-container">
<abbr class="published" title="2014-08-18T09:45:00-07:00">Mon 18 August 2014</abbr>
</div>
<div class="entry-content">
<p>This website is now live! Here you’ll find updates about my progress towards <em>Effective Python</em>‘s eventual publishing by Addison-Wesley. You can find other books from the <em>Effective</em> series <a href="http://www.informit.com/imprint/series_detail.aspx?st=61267">in Pearson’s online store</a>.</p>
</div>
</div>
</div>
</div>
</section>
<footer id="contentinfo" class="footer">
<div class="container">
<address id="about" class="vcard body">
© 2014 - 2015 <a class="url fn" href="http://www.onebigfluke.com">Brett Slatkin</a>
<span class="footer-attribution"> — Powered by <a href="http://getpelican.com/">Pelican</a></span>
</address>
</div>
</footer>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-53888969-1");
pageTracker._trackPageview();
} catch(err) {}
</script>
</body>
</html>