Effective Python: 90 specific ways to write better Python
Gespeichert in:
1. Verfasser: | |
---|---|
Format: | Buch |
Sprache: | English |
Veröffentlicht: |
[USA]
Addison-Wesley
[2020]
|
Ausgabe: | Second edition |
Schriftenreihe: | Effective software development series
|
Schlagworte: | |
Online-Zugang: | Inhaltsverzeichnis |
Beschreibung: | Previous edition: 2015 |
Beschreibung: | xxii, 444 Seiten 24 cm |
ISBN: | 9780134853987 0134853989 |
Internformat
MARC
LEADER | 00000nam a22000008c 4500 | ||
---|---|---|---|
001 | BV046252224 | ||
003 | DE-604 | ||
005 | 20220324 | ||
007 | t | ||
008 | 191113s2020 |||| 00||| eng d | ||
020 | |a 9780134853987 |9 978-0-13-485398-7 | ||
020 | |a 0134853989 |9 0-13-485398-9 | ||
035 | |a (OCoLC)1140129622 | ||
035 | |a (DE-599)BVBBV046252224 | ||
040 | |a DE-604 |b ger |e rda | ||
041 | 0 | |a eng | |
049 | |a DE-91G |a DE-29T |a DE-11 |a DE-355 | ||
084 | |a ST 250 |0 (DE-625)143626: |2 rvk | ||
084 | |a DAT 366f |2 stub | ||
100 | 1 | |a Slatkin, Brett |e Verfasser |0 (DE-588)1069070238 |4 aut | |
245 | 1 | 0 | |a Effective Python |b 90 specific ways to write better Python |c Brett Slatkin |
250 | |a Second edition | ||
264 | 1 | |a [USA] |b Addison-Wesley |c [2020] | |
300 | |a xxii, 444 Seiten |c 24 cm | ||
336 | |b txt |2 rdacontent | ||
337 | |b n |2 rdamedia | ||
338 | |b nc |2 rdacarrier | ||
490 | 0 | |a Effective software development series | |
500 | |a Previous edition: 2015 | ||
650 | 0 | 7 | |a Python |g Programmiersprache |0 (DE-588)4434275-5 |2 gnd |9 rswk-swf |
650 | 0 | 7 | |a Python 3.0 |0 (DE-588)7624871-9 |2 gnd |9 rswk-swf |
650 | 0 | 7 | |a Python 2.0 |0 (DE-588)4618843-5 |2 gnd |9 rswk-swf |
650 | 0 | 7 | |a Python 3.7 |0 (DE-588)1155266803 |2 gnd |9 rswk-swf |
653 | 0 | |a Python (Computer program language) | |
689 | 0 | 0 | |a Python |g Programmiersprache |0 (DE-588)4434275-5 |D s |
689 | 0 | |5 DE-604 | |
689 | 1 | 0 | |a Python 2.0 |0 (DE-588)4618843-5 |D s |
689 | 1 | 1 | |a Python 3.0 |0 (DE-588)7624871-9 |D s |
689 | 1 | |8 1\p |5 DE-604 | |
689 | 2 | 0 | |a Python 3.7 |0 (DE-588)1155266803 |D s |
689 | 2 | |8 2\p |5 DE-604 | |
856 | 4 | 2 | |m Digitalisierung UB Regensburg - ADAM Catalogue Enrichment |q application/pdf |u http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=031630415&sequence=000001&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA |3 Inhaltsverzeichnis |
999 | |a oai:aleph.bib-bvb.de:BVB01-031630415 | ||
883 | 1 | |8 1\p |a cgwrk |d 20201028 |q DE-101 |u https://d-nb.info/provenance/plan#cgwrk | |
883 | 1 | |8 2\p |a cgwrk |d 20201028 |q DE-101 |u https://d-nb.info/provenance/plan#cgwrk |
Datensatz im Suchindex
_version_ | 1804180679861207040 |
---|---|
adam_text | Contents at a Glance Preface Acknowledgments About the Author Chapter 1: Pythonic Thinking xvii xxi xxiii 1 Chapter 2: Lists and Dictionaries 43 Chapter 3: Functions 77 Chapter 4: Comprehensions and Generators 107 Chapter 5: Classes and Interfaces 145 Chapter 6: Metaclasses and Attributes 181 Chapter 7: Concurrency and Parallelism 225 Chapter 8: Robustness and Performance 299 Chapter 9: Testing and Debugging 353 Chapter 10: Collaboration 389 Index 435
Contents Preface xvii Acknowledgments About the Author Chapter 1 Pythonic Thinking Item Item Item Item 1: 2: 3: 4: Item 5: Item 6: Item Item Item Item 7: 8: 9: 10: Know Which Version of Python You’re Using Follow the PEP 8 Style Guide Know the Differences Between bytes and str Prefer Interpolated F-Strings Over C-style Format Strings and str.format Write Helper Functions Instead of Complex Expressions Prefer Multiple Assignment Unpacking Over Indexing Prefer enumerate Over range Use zip to Process Iterators in Parallel Avoid else Blocks After for and while Loops Prevent Repetition with Assignment Expressions Chapter 2 Lists and Dictionaries Item Item Item Item 11: 12: 13: 14: Know How to Slice Sequences Avoid Striding and Slicing in a Single Expression Prefer Catch-All Unpacking Over Slicing Sort by Complex Criteria Using the key Parameter xxi xxiii 1 1 2 5 11 21 24 28 30 32 35 43 43 46 48 52
xii Contents Item 15: Be Cautious When Relying on di et Insertion Ordering Item 16: Prefer get Over in and KeyError to Handle Missing Dictionary Keys Item 17: Prefer defaultdict Over setdefault to Handle Missing Items in Internal State Item 18: Know How to Construct Key-Dependent Default Values with_ missi ng__ Chapter 3 Functions 58 65 70 73 77 Item 19: Never Unpack More Than Three Variables When Functions Return Multiple Values 77 Item 20: Prefer Raising Exceptions to Returning None 80 Item 21: Know How Closures Interact with Variable Scope 83 Item 22: Reduce Visual Noise with Variable Positional Arguments 87 Item 23: Provide Optional Behavior with Keyword Arguments 90 Item 24: Use None and Docstrings to Specify Dynamic Default Arguments 94 Item 25: Enforce Clarity with Keyword-Only and Positional-Only Arguments 97 Item 26: Define Function Decorators withfunctools.wraps 102 Chapter 4 Comprehensions and Generators Item 27: Use Comprehensions Instead of map and filter Item 28: Avoid More Than Two Control Subexpressions in Comprehensions Item 29: Avoid Repeated Work in Comprehensions by Using Assignment Expressions 111 Item 30: Consider Generators Instead of Returning Lists Item 31: Be Defensive When Iterating Over Arguments Item 32: Consider Generator Expressions for Large List Comprehensions Item 33: Compose Multiple Generators with yield from Item 34: Avoid Injecting Data into Generators with send Item 35: Avoid Causing State Transitions in Generators with throw 107 107 109 114 117 122 124 127 133
Contents xiii Item 36: Consider itertools for Working with Iterators and Generators 138 Chapter 5 Classes and Interfaces Item 37: Compose Classes Instead of Nesting Many Levels of Built-in Types Item 38: Accept Functions Instead of Classes for Simple Interfaces Item 39: Use ©classmethod Polymorphism to Construct Objects Generically Item 40: Initialize Parent Classes with super Item 41: Consider Composing Functionality with Mix-in Classes Item 42: Prefer Public Attributes Over Private Ones Item 43: Inherit from collections.abc for Custom Container Types Chapter 6 Metaclasses and Attributes Item 44: Use Plain Attributes Instead of Setter and Getter Methods Item 45: Consider ©property Instead of Refactoring Attributes Item 46: Use Descriptors for Reusable ©property Methods Item 47: Use_ getattr_ ,__getattribute_ , and _ setattr__for Lazy Attributes Item 48: Validate Subclasses with_ init_subclass_ Item 49: Register Class Existence with_ init_subclass_ Item 50: Annotate Class Attributes with_ set_name__ Item 51: Prefer Class Decorators Over Metaclasses for Composable Class Extensions Chapter 7 Concurrency and Parallelism Item 52: Item 53: Item 54: Item 55: Item 56: Use subprocess to Manage Child Processes Use Threads for Blocking I/O, Avoid for Parallelism Use Lock to Prevent Data Races in Threads Use Queue to Coordinate Work Between Threads Know How to Recognize When Concurrency Is Necessary 145 145 152 155 160 165 170 175 181 181 186 190 195 201 208 214 218 225 226 230 235 238 248
xiv Contents Item 57: Avoid Creating New Thread Instances for On-demand Fan-out 252 Item 58: Understand How Using Queue for Concurrency Requires Refactoring 257 Item 59: Consider ThreadPoolExecutor When Threads Are Necessary for Concurrency 264 Item 60: Achieve Highly Concurrent I/O with Coroutines Item 61: Know How to Port Threaded I/O to asyncio Item 62: Mix Threads and Coroutines to Ease the Transition to asyncio Item 63: Avoid Blocking the asyncio Event Loop to Maximize Responsiveness 289 Item 64: Consider concurrent^utures for True Parallelism Chapter 8 Robustness and Performance Item 65: Take Advantage of Each Block in try/except /else/finally 299 Item 66: Consider context!ib and with Statements for Reusable try/finally Behavior 304 Item 67: Use datetime Instead of time for Local Clocks Item 68: Make pickle Reliable with copyreg Item 69: Use decimal When Precision Is Paramount Item 70: Profile Before Optimizing Item 71: Prefer deque for Producer-Consumer Queues Item 72: Consider Searching Sorted Sequences with bisect Item 73: Know How to Use heapq for Priority Queues Item 74: Consider memoryview and bytearray for Zero-Copy Interactions with bytes 346 Chapter 9 Testing and Debugging Item 75: Use repr Strings for Debugging Output Item 76: Verify Related Behaviors in TestCase Subclasses Item 77: Isolate Tests from Each Other with setup, tearDown, setUpModule, and tearDownModule 365 Item 78: Use Mocks to Test Code with Complex Dependencies 266 271 282 292 299 308 312 319 322 326 334 336 353 354 357 367
Contents Item 79: Encapsulate Dependencies to Facilitate Mocking and Testing Item 80: Consider Interactive Debugging with pdb Item 81: Use tracemalloc to Understand Memory Usage and Leaks Chapter 10 Collaboration XV 375 379 384 389 Item 82: Know Where to Find Community-Built Modules 389 Item 83: Use Virtual Environments for Isolated and Reproducible Dependencies 390 Item 84: Write Docstrings for Every Function, Class, and Module 396 Item 85: Use Packages to Organize Modules and Provide Stable APIs 401 Item 86: Consider Module-Scoped Code to Configure Deployment Environments 406 Item 87: Define a Root Exception to Insulate Callers from APIs 408 Item 88: Know How to Break Circular Dependencies 413 Item 89: Consider warnings to Refactor and Migrate Usage 418 Item 90: Consider Static Analysis via typi ng to Obviate Bugs 425 Index 435
|
any_adam_object | 1 |
author | Slatkin, Brett |
author_GND | (DE-588)1069070238 |
author_facet | Slatkin, Brett |
author_role | aut |
author_sort | Slatkin, Brett |
author_variant | b s bs |
building | Verbundindex |
bvnumber | BV046252224 |
classification_rvk | ST 250 |
classification_tum | DAT 366f |
ctrlnum | (OCoLC)1140129622 (DE-599)BVBBV046252224 |
discipline | Informatik |
edition | Second edition |
format | Book |
fullrecord | <?xml version="1.0" encoding="UTF-8"?><collection xmlns="http://www.loc.gov/MARC21/slim"><record><leader>02074nam a22005058c 4500</leader><controlfield tag="001">BV046252224</controlfield><controlfield tag="003">DE-604</controlfield><controlfield tag="005">20220324 </controlfield><controlfield tag="007">t</controlfield><controlfield tag="008">191113s2020 |||| 00||| eng d</controlfield><datafield tag="020" ind1=" " ind2=" "><subfield code="a">9780134853987</subfield><subfield code="9">978-0-13-485398-7</subfield></datafield><datafield tag="020" ind1=" " ind2=" "><subfield code="a">0134853989</subfield><subfield code="9">0-13-485398-9</subfield></datafield><datafield tag="035" ind1=" " ind2=" "><subfield code="a">(OCoLC)1140129622</subfield></datafield><datafield tag="035" ind1=" " ind2=" "><subfield code="a">(DE-599)BVBBV046252224</subfield></datafield><datafield tag="040" ind1=" " ind2=" "><subfield code="a">DE-604</subfield><subfield code="b">ger</subfield><subfield code="e">rda</subfield></datafield><datafield tag="041" ind1="0" ind2=" "><subfield code="a">eng</subfield></datafield><datafield tag="049" ind1=" " ind2=" "><subfield code="a">DE-91G</subfield><subfield code="a">DE-29T</subfield><subfield code="a">DE-11</subfield><subfield code="a">DE-355</subfield></datafield><datafield tag="084" ind1=" " ind2=" "><subfield code="a">ST 250</subfield><subfield code="0">(DE-625)143626:</subfield><subfield code="2">rvk</subfield></datafield><datafield tag="084" ind1=" " ind2=" "><subfield code="a">DAT 366f</subfield><subfield code="2">stub</subfield></datafield><datafield tag="100" ind1="1" ind2=" "><subfield code="a">Slatkin, Brett</subfield><subfield code="e">Verfasser</subfield><subfield code="0">(DE-588)1069070238</subfield><subfield code="4">aut</subfield></datafield><datafield tag="245" ind1="1" ind2="0"><subfield code="a">Effective Python</subfield><subfield code="b">90 specific ways to write better Python</subfield><subfield code="c">Brett Slatkin</subfield></datafield><datafield tag="250" ind1=" " ind2=" "><subfield code="a">Second edition</subfield></datafield><datafield tag="264" ind1=" " ind2="1"><subfield code="a">[USA]</subfield><subfield code="b">Addison-Wesley</subfield><subfield code="c">[2020]</subfield></datafield><datafield tag="300" ind1=" " ind2=" "><subfield code="a">xxii, 444 Seiten</subfield><subfield code="c">24 cm</subfield></datafield><datafield tag="336" ind1=" " ind2=" "><subfield code="b">txt</subfield><subfield code="2">rdacontent</subfield></datafield><datafield tag="337" ind1=" " ind2=" "><subfield code="b">n</subfield><subfield code="2">rdamedia</subfield></datafield><datafield tag="338" ind1=" " ind2=" "><subfield code="b">nc</subfield><subfield code="2">rdacarrier</subfield></datafield><datafield tag="490" ind1="0" ind2=" "><subfield code="a">Effective software development series</subfield></datafield><datafield tag="500" ind1=" " ind2=" "><subfield code="a">Previous edition: 2015</subfield></datafield><datafield tag="650" ind1="0" ind2="7"><subfield code="a">Python</subfield><subfield code="g">Programmiersprache</subfield><subfield code="0">(DE-588)4434275-5</subfield><subfield code="2">gnd</subfield><subfield code="9">rswk-swf</subfield></datafield><datafield tag="650" ind1="0" ind2="7"><subfield code="a">Python 3.0</subfield><subfield code="0">(DE-588)7624871-9</subfield><subfield code="2">gnd</subfield><subfield code="9">rswk-swf</subfield></datafield><datafield tag="650" ind1="0" ind2="7"><subfield code="a">Python 2.0</subfield><subfield code="0">(DE-588)4618843-5</subfield><subfield code="2">gnd</subfield><subfield code="9">rswk-swf</subfield></datafield><datafield tag="650" ind1="0" ind2="7"><subfield code="a">Python 3.7</subfield><subfield code="0">(DE-588)1155266803</subfield><subfield code="2">gnd</subfield><subfield code="9">rswk-swf</subfield></datafield><datafield tag="653" ind1=" " ind2="0"><subfield code="a">Python (Computer program language)</subfield></datafield><datafield tag="689" ind1="0" ind2="0"><subfield code="a">Python</subfield><subfield code="g">Programmiersprache</subfield><subfield code="0">(DE-588)4434275-5</subfield><subfield code="D">s</subfield></datafield><datafield tag="689" ind1="0" ind2=" "><subfield code="5">DE-604</subfield></datafield><datafield tag="689" ind1="1" ind2="0"><subfield code="a">Python 2.0</subfield><subfield code="0">(DE-588)4618843-5</subfield><subfield code="D">s</subfield></datafield><datafield tag="689" ind1="1" ind2="1"><subfield code="a">Python 3.0</subfield><subfield code="0">(DE-588)7624871-9</subfield><subfield code="D">s</subfield></datafield><datafield tag="689" ind1="1" ind2=" "><subfield code="8">1\p</subfield><subfield code="5">DE-604</subfield></datafield><datafield tag="689" ind1="2" ind2="0"><subfield code="a">Python 3.7</subfield><subfield code="0">(DE-588)1155266803</subfield><subfield code="D">s</subfield></datafield><datafield tag="689" ind1="2" ind2=" "><subfield code="8">2\p</subfield><subfield code="5">DE-604</subfield></datafield><datafield tag="856" ind1="4" ind2="2"><subfield code="m">Digitalisierung UB Regensburg - ADAM Catalogue Enrichment</subfield><subfield code="q">application/pdf</subfield><subfield code="u">http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=031630415&sequence=000001&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA</subfield><subfield code="3">Inhaltsverzeichnis</subfield></datafield><datafield tag="999" ind1=" " ind2=" "><subfield code="a">oai:aleph.bib-bvb.de:BVB01-031630415</subfield></datafield><datafield tag="883" ind1="1" ind2=" "><subfield code="8">1\p</subfield><subfield code="a">cgwrk</subfield><subfield code="d">20201028</subfield><subfield code="q">DE-101</subfield><subfield code="u">https://d-nb.info/provenance/plan#cgwrk</subfield></datafield><datafield tag="883" ind1="1" ind2=" "><subfield code="8">2\p</subfield><subfield code="a">cgwrk</subfield><subfield code="d">20201028</subfield><subfield code="q">DE-101</subfield><subfield code="u">https://d-nb.info/provenance/plan#cgwrk</subfield></datafield></record></collection> |
id | DE-604.BV046252224 |
illustrated | Not Illustrated |
indexdate | 2024-07-10T08:39:36Z |
institution | BVB |
isbn | 9780134853987 0134853989 |
language | English |
oai_aleph_id | oai:aleph.bib-bvb.de:BVB01-031630415 |
oclc_num | 1140129622 |
open_access_boolean | |
owner | DE-91G DE-BY-TUM DE-29T DE-11 DE-355 DE-BY-UBR |
owner_facet | DE-91G DE-BY-TUM DE-29T DE-11 DE-355 DE-BY-UBR |
physical | xxii, 444 Seiten 24 cm |
publishDate | 2020 |
publishDateSearch | 2020 |
publishDateSort | 2020 |
publisher | Addison-Wesley |
record_format | marc |
series2 | Effective software development series |
spelling | Slatkin, Brett Verfasser (DE-588)1069070238 aut Effective Python 90 specific ways to write better Python Brett Slatkin Second edition [USA] Addison-Wesley [2020] xxii, 444 Seiten 24 cm txt rdacontent n rdamedia nc rdacarrier Effective software development series Previous edition: 2015 Python Programmiersprache (DE-588)4434275-5 gnd rswk-swf Python 3.0 (DE-588)7624871-9 gnd rswk-swf Python 2.0 (DE-588)4618843-5 gnd rswk-swf Python 3.7 (DE-588)1155266803 gnd rswk-swf Python (Computer program language) Python Programmiersprache (DE-588)4434275-5 s DE-604 Python 2.0 (DE-588)4618843-5 s Python 3.0 (DE-588)7624871-9 s 1\p DE-604 Python 3.7 (DE-588)1155266803 s 2\p DE-604 Digitalisierung UB Regensburg - ADAM Catalogue Enrichment application/pdf http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=031630415&sequence=000001&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA Inhaltsverzeichnis 1\p cgwrk 20201028 DE-101 https://d-nb.info/provenance/plan#cgwrk 2\p cgwrk 20201028 DE-101 https://d-nb.info/provenance/plan#cgwrk |
spellingShingle | Slatkin, Brett Effective Python 90 specific ways to write better Python Python Programmiersprache (DE-588)4434275-5 gnd Python 3.0 (DE-588)7624871-9 gnd Python 2.0 (DE-588)4618843-5 gnd Python 3.7 (DE-588)1155266803 gnd |
subject_GND | (DE-588)4434275-5 (DE-588)7624871-9 (DE-588)4618843-5 (DE-588)1155266803 |
title | Effective Python 90 specific ways to write better Python |
title_auth | Effective Python 90 specific ways to write better Python |
title_exact_search | Effective Python 90 specific ways to write better Python |
title_full | Effective Python 90 specific ways to write better Python Brett Slatkin |
title_fullStr | Effective Python 90 specific ways to write better Python Brett Slatkin |
title_full_unstemmed | Effective Python 90 specific ways to write better Python Brett Slatkin |
title_short | Effective Python |
title_sort | effective python 90 specific ways to write better python |
title_sub | 90 specific ways to write better Python |
topic | Python Programmiersprache (DE-588)4434275-5 gnd Python 3.0 (DE-588)7624871-9 gnd Python 2.0 (DE-588)4618843-5 gnd Python 3.7 (DE-588)1155266803 gnd |
topic_facet | Python Programmiersprache Python 3.0 Python 2.0 Python 3.7 |
url | http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=031630415&sequence=000001&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA |
work_keys_str_mv | AT slatkinbrett effectivepython90specificwaystowritebetterpython |