Prix bas
CHF68.80
Habituellement expédié sous 2 à 4 jours ouvrés.
Ready to master Python? Learn to write effective code, whether you're a beginner or a professional programmer. Review core Python concepts, including functions, modularization, and object orientation and walk through the available data types. Then dive into more advanced topics, such as using Django and working with GUIs. With plenty of code examples throughout, this hands-on reference guide has everything you need to become proficient in Python!
Highlights include:
1) Functions
2) Methods
3) Attributes
4) Data types
5) GUIs
6) Debugging
7) Network communication
8) Modularization
9) Object orientation
10) Iterators
11) Generators
12) Exception handling
Consult and download practical code examples
Contenu
1 ... Introduction ... 33
1.1 ... Why Did We Write This Book? ... 33
1.2 ... What Does This Book Provide? ... 34
1.3 ... Structure of the Book ... 34
1.4 ... How Should You Read This Book? ... 35
1.5 ... Sample Programs ... 36
1.6 ... Preface To the First English Edition (2022) ... 36
1.7 ... Acknowledgments ... 37
2 ... The Python Programming Language ... 39
2.1 ... History, Concepts, and Areas of Application ... 39
2.2 ... Installing Python ... 42
2.3 ... Installing Third-Party Modules ... 45
2.4 ... Using Python ... 45
PART I ... Getting Started with Python ... 47
3 ... Getting Started with the Interactive Mode ... 49
3.1 ... Integers ... 49
3.2 ... Floats ... 51
3.3 ... Character Strings ... 51
3.4 ... Lists ... 52
3.5 ... Dictionaries ... 53
3.6 ... Variables ... 54
3.7 ... Logical Expressions ... 55
3.8 ... Functions and Methods ... 57
3.9 ... Screen Outputs ... 59
3.10 ... Modules ... 60
4 ... The Path to the First Program ... 63
4.1 ... Typing, Compiling, and Testing ... 63
4.2 ... Basic Structure of a Python Program ... 66
4.3 ... The First Program ... 70
4.4 ... Comments ... 72
4.5 ... In Case of Error ... 72
5 ... Control Structures ... 75
5.1 ... Conditionals ... 75
5.2 ... Loops ... 79
5.3 ... The pass Statement ... 87
5.4 ... Assignment Expressions ... 87
6 ... Files ... 91
6.1 ... Data Streams ... 91
6.2 ... Reading Data from a File ... 92
6.3 ... Writing Data to a File ... 96
6.4 ... Generating the File Object ... 97
7 ... The Data Model ... 103
7.1 ... The Structure of Instances ... 105
7.2 ... Deleting References ... 109
7.3 ... Mutable versus Immutable Data Types ... 111
8 ... Functions, Methods, and Attributes ... 115
8.1 ... Parameters of Functions and Methods ... 115
8.2 ... Attributes ... 118
9 ... Sources of Information on Python ... 119
9.1 ... The Built-In Help Function ... 119
9.2 ... The Online Documentation ... 120
9.3 ... PEPs ... 120
PART II ... Data Types ... 123
10 ... Basic Data Types: An Overview ... 125
10.1 ... Nothingness: NoneType ... 126
10.2 ... Operators ... 127
11 ... Numeric Data Types ... 131
11.1 ... Arithmetic Operators ... 131
11.2 ... Comparison Operators ... 133
11.3 ... Conversion between Numeric Data Types ... 134
11.4 ... Integers: int ... 135
11.5 ... Floats: float ... 141
11.6 ... Boolean Values: bool ... 144
11.7 ... Complex Numbers: complex ... 149
12 ... Sequential Data Types ... 153
12.1 ... The Difference between Text and Binary Data ... 153
12.2 ... Operations on Instances of Sequential Data Types ... 154
12.3 ... The list Data Type ... 166
12.4 ... Immutable Lists: tuple ... 179
12.5 ... Strings: str, bytes, bytearray ... 182
13 ... Mappings and Sets ... 215
13.1 ... Dictionary: dict ... 215
13.2 ... Sets: set and frozenset ... 227
14 ... Collections ... 239
14.1 ... Chained Dictionaries ... 239
14.2 ... Counting Frequencies ... 240
14.3 ... Dictionaries with Default Values ... 242
14.4 ... Doubly Linked Lists ... 243
14.5 ... Named Tuples ... 245
15 ... Date and Time ... 247
15.1 ... Elementary Time Functionstime ... 247
15.2 ... Object-Oriented Date Management: datetime ... 254
15.3 ... Time Zones: zoneinfo ... 263
16 ... Enumerations and Flags ... 269
16.1 ... Enumeration Types: enum ... 269
16.2 ... Enumeration Types for Bit Patterns: flag ... 271
16.3 ... Integer Enumeration Types: IntEnum ... 272
PART III ... Advanced Programming Techniques ... 275
17 ... Functions ... 277
17.1 ... Defining a Function ... 278
17.2 ... Return Values ... 280
17.3 ... Function Objects ... 282
17.4 ... Optional Parameters ... 282
17.5 ... Keyword Arguments ... 283
17.6 ... Arbitrarily Many Parameters ... 284
17.7 ... Keyword-Only Parameters ... 286
17.8 ... Positional-Only Parameters ... 287
17.9 ... Unpacking When Calling a Function ... 288
17.10 ... Side Effects ... 290
17.11 ... Namespaces ... 293
17.12 ... Anonymous Functions ... 299
17.13 ... Recursion ... 300
17.14 ... Built-In Functions ... 300
18 ... Modules and Packages ... 325
18.1 ... Importing Global Modules ... 326
18.2 ... Local Modules ... 328
18.3 ... Packages ... 331
18.4 ... The importlib Package ... 335
18.5 ... Planned Language Elements ... 338
19 ... Object-Oriented Programming ... 341
19.1 ... Example: A Non-Object-Oriented Account ... 341
19.2 ... Classes ... 346
19.3 ... Inheritance ... 351
19.4 ... Multiple Inheritance ... 363
19.5 ... Property Attributes ... 365
19.6 ... Static Methods ... 367
19.7 ... Class Methods ... 369
19.8 ... Class Attributes ... 370
19.9 ... Built-in Functions for Object-Oriented Programming ... 370
19.10 ... Inheriting Built-In Data Types ... 373
19.11 ... Magic Methods and Magic Attributes ... 375
19.12 ... Data Classes ... 393
20 ... Exception Handling ... 399
20.1 ... Exceptions ... 399
20.2 ... Assertions ... 411
20.3 ... Warnings ... 412
21 ... Generators and Iterators ... 415
21.1 ... Generators ... 415
21.2 ... Iterators ... 422
21.3 ... Special Generators: itertools ... 432
22 ... Context Manager ... 441
22.1 ... The with Statement ... 441
22.2 ... Helper Functions for with Contexts: contextlib ... 444
23 ... Decorators ... 449
23.1 ... Function Decorators ... 449
23.2 ... Class Decorators ... 454
23.3 ... The functools Module ... 455
24 ... Annotations for Static Type Checking ... 463
24.1 ... Annotations ... 464
24.2 ... Type Hints: The typing Module ... 471
24.3 ... Static Type Checking in Python: mypy ... 476
25 ... Structural Pattern Matching ... 479
25.1 ... The match Statement ... 479
25.2 ... Pattern Types in the case Statement ... 480
PART IV ... The Standard Library ... 495
26 ... Mathematics ... 497
26.1 ... Mathematical Functions: math, cmath ... 497
26.2 ... Random Number Generator: random ... 503
26.3 ... Statistical Calculations: statistics ... 507
26.4 ... Intuitive Decimal Numbers: decimal ... 509
26.5 ... Hash Functions: hashlib ... 514
27 ... Screen Outputs and Logging ... 521
27.1 ... Formatted Output of Complex Objects: pprint ... 521
27.2 ... Log Files: logging ... 523
28 ... Regular Expressions ... 529 …