|
1 | 1 | # Example code for [Effective Python LiveLessons](http://www.informit.com/store/effective-python-livelessons-video-training-downloadable-9780134175164) |
2 | 2 |
|
3 | | -These items are numbered differently than in the book. Below are links to each item's corresponding piece of example code. |
| 3 | +**This is for a previous edition of the book.** |
4 | 4 |
|
5 | | -To run all the code for an item, just type ./item_01.py into your shell and see what it prints out. Alternatively you can type python3 item_01.py or python2.7 item_03_example_03.py to run a specific version of Python. |
6 | | - |
7 | | -- "[Item 1 Know how to slice sequences](example_code/item_05.py)" |
8 | | -- "[Item 2 Avoid using start, end, and stride in a single slice](example_code/item_05.py)" |
9 | | -- "[Item 3 Prefer enumerate over range](example_code/item_10.py)" |
10 | | -- "[Item 4 Use zip to process iterators in parallel](example_code/item_11.py)" |
11 | | -- "[Item 5 Avoid else blocks after for and while loops](example_code/item_12.py)" |
12 | | -- "[Item 6 Take advantage of each block in try/except/else/finally](example_code/item_13.py)" |
13 | | -- "[Item 7 Consider contextlib and with statements for reusable try/finally behavior](example_code/item_43.py)" |
14 | | -- "[Item 8 Use list comprehensions instead of map and filter](example_code/item_07.py)" |
15 | | -- "[Item 9 Avoid more than two expressions in list comprehensions](example_code/item_08.py)" |
16 | | -- "[Item 10 Consider generator expressions for large comprehensions](example_code/item_09.py)" |
17 | | -- "[Item 11 Consider generators instead of returning lists](example_code/item_16.py)" |
18 | | -- "[Item 12 Be defensive when iterating over arguments ](example_code/item_17.py)" |
19 | | -- "[Item 13 Know how closures interact with variable scope](example_code/item_15.py)" and [example for Python 2](example_code/item_15_example_09.py) |
20 | | -- "[Item 14 Accept functions for simple interfaces instead of classes](example_code/item_23.py)" |
21 | | -- "[Item 15 Reduce visual noise with variable positional arguments](example_code/item_19.py)" |
22 | | -- "[Item 16 Provide optional behavior with keyword arguments](example_code/item_19.py)" |
23 | | -- "[Item 17 Enforce clarity with keyword-only arguments](example_code/item_21.py)" |
24 | | -- "[Item 18 Use None and docstrings to specify dynamic default arguments](example_code/item_20.py)" |
25 | | -- "[Item 19 Prefer helper classes over bookkeeping with dictionaries and tuples](example_code/item_22.py)" |
26 | | -- "[Item 20 Use plain attributes instead of get and set methods ](example_code/item_29.py)" |
27 | | -- "[Item 21 Prefer public attributes over private ones](example_code/item_27.py)" |
28 | | -- "[Item 22 Use @classmethod polymorphism to construct objects generically](example_code/item_24.py)" |
29 | | -- "[Item 23 Use subprocess to manage child processes](example_code/item_36.py)" |
30 | | -- "[Item 24 Use threads for blocking I/O, avoid for parallelism](example_code/item_37.py)" |
31 | | -- "[Item 25 Use Lock to prevent data races in threads](example_code/item_38.py)" |
32 | | -- "[Item 26 Use Queue to coordinate work between threads](example_code/item_39.py)" |
33 | | -- "[Item 27 Consider concurrent.futures for true parallelism](example_code/item_41.py)" |
34 | | -- "Item 28 Use virtual environments for isolated and reproducible dependencies" has no example code |
35 | | -- "[Item 29 Test everything with unittest](example_code/item_56.py) and [a directory of tests](example_code/item_56/testing)" |
36 | | -- "Item 30 Consider interactive debugging with pdb" has no example code |
37 | | -- "[Item 31 Profile before optimizing](example_code/item_58.py)" |
38 | | -- "[Item 32 Use tracemalloc to understand memory usage and leaks](example_code/item_59/tracemalloc)" |
| 5 | +[Go here to see the corresponding example code](../v1/VIDEO.md) |
0 commit comments