HOME > Detail View

Detail View

Effective Python : 59 specific ways to write better Python

Effective Python : 59 specific ways to write better Python (Loan 2 times)

Material type
단행본
Personal Author
Slatkin, Brett.
Title Statement
Effective Python : 59 specific ways to write better Python / Brett Slatkin.
Publication, Distribution, etc
Upper Saddle River, NJ :   Addison-Wesley,   c2015.  
Physical Medium
xviii, 227 p. : ; 24 cm.
ISBN
9780134034287 (pbk. : alk. paper) 0134034287 (pbk. : alk. paper)
General Note
Includes index.  
Subject Added Entry-Topical Term
Python (Computer program language). Computer programming.
000 00000cam u2200205 a 4500
001 000045965709
005 20181227144009
008 181224s2015 nju 001 0 eng d
010 ▼a 2014048305
020 ▼a 9780134034287 (pbk. : alk. paper)
020 ▼a 0134034287 (pbk. : alk. paper)
035 ▼a (KERIS)REF000017625878
040 ▼a DLC ▼b eng ▼c DLC ▼e rda ▼d DLC ▼d 211009
050 0 0 ▼a QA76.73.P98 ▼b S57 2015
082 0 0 ▼a 005.13/3 ▼2 23
084 ▼a 005.133 ▼2 DDCK
090 ▼a 005.133 ▼b S6312e
100 1 ▼a Slatkin, Brett.
245 1 0 ▼a Effective Python : ▼b 59 specific ways to write better Python / ▼c Brett Slatkin.
260 ▼a Upper Saddle River, NJ : ▼b Addison-Wesley, ▼c c2015.
300 ▼a xviii, 227 p. : ; ▼c 24 cm.
500 ▼a Includes index.
650 0 ▼a Python (Computer program language).
650 0 ▼a Computer programming.
945 ▼a KLPA

Holdings Information

No. Location Call Number Accession No. Availability Due Date Make a Reservation Service
No. 1 Location Main Library/Western Books/ Call Number 005.133 S6312e Accession No. 111801251 Availability Available Due Date Make a Reservation Service B M

Contents information

Table of Contents

Preface	p. xiii
Acknowledgments	p. xvii
About the Author	p. xix
Chapter 1	Pythonic Thinking	p. 1
Item 1	    Know Which Version of Python You''re Using	p. 1
Item 2	    Follow the PEP 8 Style Guide	p. 2
Item 3	    Know the Differences Between bytes, str, and unicode	p. 5
Item 4	    Write Helper Functions Instead of Complex Expressions	p. 8
Item 5	    Know How to Slice Sequences	p. 10
Item 6	    Avoid Using start, end, and stride in a Single Slice	p. 13
Item 7	    Use List Comprehensions Instead of map and filter	p. 15
Item 8	    Avoid More Than Two Expressions in List Comprehensions	p. 16
Item 9	    Consider Generator Expressions for Large Comprehensions	p. 18
Item 10	    Prefer enumerate Over range	p. 20
Item 11	    Use zip to Process Iterators in Parallel	p. 21
Item 12	    Avoid else Blocks After for and while Loops	p. 23
Item 13	    Take Advantage of Each Block in try/except/else/finally	p. 26
Chapter 2	Functions	p. 29
Item 14	    Prefer Exceptions to Returning None	p. 29
Item 15	    Know How Closures Interact with Variable Scope	p. 31
Item 16	    Consider Generators Instead of Returning Lists	p. 36
Item 17	    Be Defensive When Iterating Over Arguments	p. 38
Item 18	    Reduce Visual Noise with Variable Positional Arguments	p. 43
Item 19	    Provide Optional Behavior with Keyword Arguments	p. 45
Item 20	    Use None and Docstrings to Specify Dynamic Default Arguments	p. 48
Item 21	    Enforce Clarity with Keyword-Only Arguments	p. 51
Chapter 3	Classes and Inheritance	p. 55
Item 22	    Prefer Helper Classes Over Bookkeeping with Dictionaries and Tuples	p. 55
Item 23	    Accept Functions for Simple Interfaces Instead of Classes	p. 61
Item 24	    Use @classmethod Polymorphism to Construct Objects Generically	p. 64
Item 25	    Initialize Parent Classes with super	p. 69
Item 26	    Use Multiple Inheritance Only for Mix-in Utility Classes	p. 73
Item 27	    Prefer Public Attributes Over Private Ones	p. 78
Item 28	    Inherit from collections.abc for Custom Container Types	p. 83
Chapter 4	Metaclasses and Attributes	p. 87
Item 29	    Use Plain Attributes Instead of Get and Set Methods	p. 87
Item 30	    Consider @property Instead of Refactoring Attributes	p. 91
Item 31	    Use Descriptors for Reusable @property Methods	p. 95
Item 32	    Use getattr, getattribute, and setattr for Lazy Attributes	p. 100
Item 33	    Validate Subclasses with Metaclasses	p. 105
Item 34	    Register Class Existence with Metaclasses	p. 108
Item 35	    Annotate Class Attributes with Metaclasses	p. 112
Chapter 5	Concurrency and Parallelism	p. 117
Item 36	    Use subprocess to Manage Child Processes	p. 118
Item 37	    Use Threads for Blocking I/O, Avoid for Parallelism	p. 122
Item 38	    Use Lock to Prevent Data Races in Threads	p. 126
Item 39	    Use Queue to Coordinate Work Between Threads	p. 129
Item 40	    Consider Coroutines to Run Many Functions Concurrently	p. 136
Item 41	    Consider concurrent, futures for True Parallelism	p. 145
Chapter 6	Built-in Modules	p. 151
Item 42	    Define Function Decorators with functools.wraps	p. 151
Item 43	    Consider contextlib and with Statements for Reusable try/finally Behavior	p. 153
Item 44	    Make pickle Reliable with copyreg	p. 157
Item 45	    Use datetime Instead of time for Local Clocks	p. 162
Item 46	    Use Built-in Algorithms and Data Structures	p. 166
Item 47	    Use decimal When Precision Is Paramount	p. 171
Item 48	    Know Where to Find Community-Built Modules	p. 173
Chapter 7	Collaboration	p. 175
Item 49	    Write Docstrings for Every Function, Class, and Module	p. 175
Item 50	    Use Packages to Organize Modules and Provide Stable APIs	p. 179
Item 51	    Define a Root Exception to Insulate Callers from APIs	p. 184
Item 52	    Know How to Break Circular Dependencies	p. 187
Item 53	    Use Virtual Environments for Isolated and Reproducible Dependencies	p. 192
Chapter 8	Production	p. 199
Item 54	    Consider Module-Scoped Code to Configure Deployment Environments	p. 199
Item 55	    Use repr Strings for Debugging Output	p. 202
Item 56	    Test Everything with unittest	p. 204
Item 57	    Consider Interactive Debugging with pdb	p. 208
Item 58	    Profile Before Optimizing	p. 209
Item 59	    Use tracemalloc to Understand Memory Usage and Leaks	p. 214
Index	p. 217

New Arrivals Books in Related Fields