Python Distilled

Langbeschreibung
Expert insight for modern Python (3.6+) coding from the author of Python Essential Reference
Inhaltsverzeichnis
Preface xiiiChapter 1: Python Basics 11.1 Running Python 11.2 Python Programs 21.3 Primitives, Variables, and Expressions 31.4 Arithmetic Operators 51.5 Conditionals and Control Flow 71.6 Text Strings 91.7 File Input and Output 121.8 Lists 131.9 Tuples 151.10 Sets 171.11 Dictionaries 181.12 Iteration and Looping 211.13 Functions 221.14 Exceptions 241.15 Program Termination 261.16 Objects and Classes 261.17 Modules 301.18 Script Writing 321.19 Packages 331.20 Structuring an Application 341.21 Managing Third-Party Packages 351.22 Python: It Fits Your Brain 36Chapter 2: Operators, Expressions, and Data Manipulation 372.1 Literals 372.2 Expressions and Locations 382.3 Standard Operators 392.4 In-Place Assignment 412.5 Object Comparison 422.6 Ordered Comparison Operators 422.7 Boolean Expressions and Truth Values 432.8 Conditional Expressions 442.9 Operations Involving Iterables 452.10 Operations on Sequences 472.11 Operations on Mutable Sequences 492.12 Operations on Sets 502.13 Operations on Mappings 512.14 List, Set, and Dictionary Comprehensions 522.15 Generator Expressions 542.16 The Attribute (.) Operator 562.17 The Function Call () Operator 562.18 Order of Evaluation 562.19 Final Words: The Secret Life of Data 58Chapter 3: Program Structure and Control Flow 593.1 Program Structure and Execution 593.2 Conditional Execution 593.3 Loops and Iteration 603.4 Exceptions 643.5 Context Managers and the with Statement 753.6 Assertions and __debug__ 773.7 Final Words 78Chapter 4: Objects, Types, and Protocols 794.1 Essential Concepts 794.2 Object Identity and Type 804.3 Reference Counting and Garbage Collection 814.4 References and Copies 834.5 Object Representation and Printing 844.6 First-Class Objects 854.7 Using None for Optional or Missing Data 874.8 Object Protocols and Data Abstraction 874.9 Object Protocol 894.10 Number Protocol 904.11 Comparison Protocol 924.12 Conversion Protocols 944.13 Container Protocol 954.14 Iteration Protocol 974.15 Attribute Protocol 984.16 Function Protocol 984.17 Context Manager Protocol 994.18 Final Words: On Being Pythonic 99Chapter 5: Functions 1015.1 Function Definitions 1015.2 Default Arguments 1015.3 Variadic Arguments 1025.4 Keyword Arguments 1035.5 Variadic Keyword Arguments 1045.6 Functions Accepting All Inputs 1045.7 Positional-Only Arguments 1055.8 Names, Documentation Strings, and Type Hints 1065.9 Function Application and Parameter Passing 1075.10 Return Values 1095.11 Error Handling 1105.12 Scoping Rules 1115.13 Recursion 1145.14 The lambda Expression 1145.15 Higher-Order Functions 1155.16 Argument Passing in Callback Functions 1185.17 Returning Results from Callbacks 1215.18 Decorators 1245.19 Map, Filter, and Reduce 1275.20 Function Introspection, Attributes, and Signatures 1295.21 Environment Inspection 1315.22 Dynamic Code Execution and Creation 1335.23 Asynchronous Functions and await 1355.24 Final Words: Thoughts on Functions and Composition 137Chapter 6: Generators 1396.1 Generators and yield 1396.2 Restartable Generators 1426.3 Generator Delegation 1426.4 Using Generators in Practice 1446.5 Enhanced Generators and yield Expressions 1466.6 Applications of Enhanced Generators 1486.7 Generators and the Bridge to Awaiting 1516.8 Final Words: A Brief History of Generators and Looking Forward 152Chapter 7: Classes and Object-Oriented Programming 1537.1 Objects 1537.2 The class Statement 1547.3 Instances 1557.4 Attribute Access 1567.5 Scoping Rules 1587.6 Operator Overloading and Protocols 1597.7 Inheritance 1607.8 Avoiding Inheritance via Composition 1637.9 Avoiding Inheritance via Functions 1667.10 Dynamic Binding and Duck Typing 1677.11 The Danger of Inheriting from Built-in Types 1677.12 Class Variables and Methods 1697.13 Static Methods 1737.14 A Word about Design Patterns 1767.15 Data Encapsulation and Private Attributes 1767.16 Type Hinting 1797.17 Properties 1807.18 Types, Interfaces, and Abstract Base Classes 1837.19 Multiple Inheritance, Interfaces, and Mixins 1877.20 Type-Based Dispatch 1937.21 Class Decorators 1947.22 Supervised Inheritance 1977.23 The Object Life Cycle and Memory Management 1997.24 Weak References 2047.25 Internal Object Representation and Attribute Binding 2067.26 Proxies, Wrappers, and Delegation 2087.27 Reducing Memory Use with __slots__ 2107.28 Descriptors 2117.29 Class Definition Process 2157.30 Dynamic Class Creation 2167.31 Metaclasses 2177.32 Built-in Objects for Instances and Classes 2227.33 Final Words: Keep It Simple 223Chapter 8: Modules and Packages 2258.1 Modules and the import Statement 2258.2 Module Caching 2278.3 Importing Selected Names from a Module 2288.4 Circular Imports 2308.5 Module Reloading and Unloading 2328.6 Module Compilation 2338.7 The Module Search Path 2348.8 Execution as the Main Program 2348.9 Packages 2358.10 Imports Within a Package 2378.11 Running a Package Submodule as a Script 2388.12 Controlling the Package Namespace 2398.13 Controlling Package Exports 2408.14 Package Data 2418.15 Module Objects 2428.16 Deploying Python Packages 2438.17 The Penultimate Word: Start with a Package 2448.18 The Final Word: Keep It Simple 245Chapter 9: Input and Output 2479.1 Data Representation 2479.2 Text Encoding and Decoding 2489.3 Text and Byte Formatting 2509.4 Reading Command-Line Options 2549.5 Environment Variables 2569.6 Files and File Objects 2569.7 I/O Abstraction Layers 2609.8 Standard Input, Output, and Error 2639.9 Directories 2649.10 The print() function 2659.11 Generating Output 2659.12 Consuming Input 2669.13 Object Serialization 2689.14 Blocking Operations and Concurrency 2699.15 Standard Library Modules 2739.16 Final Words 296Chapter 10: Built-in Functions and Standard Library 29710.1 Built-in Functions 29710.2 Built-in Exceptions 31410.3 Standard Library 31810.4 Final Words: Use the Built-Ins 320Index 321
David Beazley is the author of the Python Essential Reference, Fourth Edition (Addison-Wesley), and Python Cookbook, Third Edition (O'Reilly Media). He currently teaches advanced computer science courses through his company, Dabeaz LLC (dabeaz.com). He's been using, writing about, speaking about, and teaching Python since 1996.
ISBN-13:
9780134173276
Veröffentl:
2021
Erscheinungsdatum:
22.09.2021
Seiten:
336
Autor:
David Beazley
Gewicht:
621 g
Format:
229x174x15 mm
Serie:
Developer's Library
Sprache:
Englisch

47,07 €*

Lieferzeit: Sofort lieferbari
Alle Preise inkl. MwSt. | zzgl. Versand