Learning Python, 2nd Edition
معرفی کتاب «Learning Python, 2nd Edition» نوشتهٔ Lutz, Mark, Ascher, David، منتشرشده توسط نشر O'Reilly Media در سال 2003. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است. «Learning Python, 2nd Edition» در دستهٔ بدون دستهبندی قرار دارد.
Portable, powerful, and a breeze to use, Python is the popular open source object-oriented programming language used for both standalone programs and scripting applications. Python is considered easy to learn, but there's no quicker way to mastery of the language than learning from an expert teacher. This edition of Learning Python puts you in the hands of two expert teachers, Mark Lutz and David Ascher, whose Read more... Abstract: Portable, powerful, and a breeze to use, Python is the popular open source object-oriented programming language used for both standalone programs and scripting applications. Python is considered easy to learn, but there's no quicker way to mastery of the language than learning from an expert teacher. This edition of Learning Python puts you in the hands of two expert teachers, Mark Lutz and David Ascher, whose friendly, well-structured prose has guided many a programmer to proficiency with the language. Learning Python, Second Edition, offers programmers a comprehensive learning tool for Python and object-oriented programming. Thoroughly updated for the numerous language and class presentation changes that have taken place since the release of the first edition in 1999, this guide introduces the basic elements of the latest release of Python 2.3 and covers new features, such as list comprehensions, nested scopes, and iterators/generators. Beyond language features, this edition of Learning Python also includes new context for less-experienced programmers, including fresh overviews of object-oriented programming and dynamic typing, new discussions of program launch and configuration options, new coverage of documentation sources, and more. There are also new use cases throughout to make the application of language features more concrete. The first part of Learning Python gives programmers all the information they'll need to understand and construct programs in the Python language, including types, operators, statements, classes, functions, modules and exceptions. The authors then present more advanced material, showing how Python performs common tasks by offering real applications and the libraries available for those applications. Each chapter ends with a series of exercises that will test your Python skills and measure your understanding. Learning Python, Second Edition is a self-paced book that allows readers to focus on the core Python language in depth. As you work through the book, you'll gain a deep and complete understanding of the Python language that will help you to understand the larger application-level examples that you'll encounter on your own. If you're interested in learning Python--and want to do so quickly and efficiently--then Learning Python, Second Edition is your best choice Main Page......Page 1 Table of content......Page 2 Copyright......Page 8 Dedication......Page 9 Preface......Page 10 About This Second Edition......Page 11 Prerequisites......Page 13 This Book's Scope......Page 14 This Book's Style and Structure......Page 15 Book Updates......Page 18 Font Conventions......Page 19 About the Programs in This Book......Page 21 Using Code Examples......Page 22 How to Contact Us......Page 23 Acknowledgments......Page 24 Part I: Getting Started......Page 27 Chapter 1. A Python Q&A Session......Page 28 1.1 Why Do People Use Python?......Page 29 1.2 Is Python a Scripting Language?......Page 31 1.3 Okay, But What's the Downside?......Page 32 1.4 Who Uses Python Today?......Page 33 1.5 What Can I Do with Python?......Page 34 1.6 What Are Python's Technical Strengths?......Page 37 1.7 How Does Python Stack Up to Language X?......Page 41 Chapter 2. How Python Runs Programs......Page 42 2.1 Introducing the Python Interpreter......Page 43 2.2 Program Execution......Page 45 2.3 Execution Model Variations......Page 48 Chapter 3. How You Run Programs......Page 51 3.1 Interactive Coding......Page 52 3.2 System Command Lines and Files......Page 55 3.3 Clicking Windows File Icons......Page 58 3.4 Module Imports and Reloads......Page 61 3.5 The IDLE User Interface......Page 65 3.6 Other IDEs......Page 70 3.7 Embedding Calls......Page 71 3.8 Frozen Binary Executables......Page 72 3.9 Text Editor Launch Options......Page 73 3.10 Other Launch Options......Page 74 3.11 Future Possibilities?......Page 75 3.12 Which Option Should I Use?......Page 76 3.13 Part I Exercises......Page 77 Part II: Types and Operations......Page 79 Chapter 4. Numbers......Page 80 4.1 Python Program Structure......Page 81 4.2 Why Use Built-in Types?......Page 82 4.3 Numbers......Page 84 4.4 Python Expression Operators......Page 87 4.5 Numbers in Action......Page 91 4.6 The Dynamic Typing Interlude......Page 98 Chapter 5. Strings......Page 103 5.1 String Literals......Page 104 5.2 Strings in Action......Page 111 5.3 String Formatting......Page 116 5.4 String Methods......Page 119 5.5 General Type Categories......Page 124 Chapter 6. Lists and Dictionaries......Page 126 6.1 Lists......Page 127 6.2 Lists in Action......Page 129 6.3 Dictionaries......Page 133 6.4 Dictionaries in Action......Page 136 Chapter 7. Tuples, Files, and Everything Else......Page 143 7.1 Tuples......Page 144 7.2 Files......Page 147 7.3 Type Categories Revisited......Page 149 7.4 Object Generality......Page 150 7.5 References Versus Copies......Page 151 7.6 Comparisons, Equality, and Truth......Page 153 7.7 Python's Type Hierarchies......Page 156 7.8 Other Types in Python......Page 158 7.9 Built-in Type Gotchas......Page 159 7.10 Part II Exercises......Page 161 Part III: Statements and Syntax......Page 164 Chapter 8. Assignment, Expressions, and Print......Page 165 8.1 Assignment Statements......Page 167 8.2 Expression Statements......Page 173 8.3 Print Statements......Page 174 Chapter 9. if Tests......Page 177 9.1 if Statements......Page 178 9.2 Python Syntax Rules......Page 180 9.3 Truth Tests......Page 184 Chapter 10. while and for Loops......Page 187 10.1 while Loops......Page 188 10.2 break, continue, pass, and the Loop else......Page 190 10.3 for Loops......Page 194 10.4 Loop Variations......Page 198 Chapter 11. Documenting Python Code......Page 203 11.1 The Python Documentation Interlude......Page 204 11.2 Common Coding Gotchas......Page 215 11.3 Part III Exercises......Page 217 Part IV: Functions......Page 219 Chapter 12. Function Basics......Page 220 12.1 Why Use Functions?......Page 221 12.2 Coding Functions......Page 222 12.3 A First Example: Definitions and Calls......Page 225 12.4 A Second Example: Intersecting Sequences......Page 228 Chapter 13. Scopes and Arguments......Page 230 13.1 Scope Rules......Page 231 13.2 The global Statement......Page 235 13.3 Scopes and Nested Functions......Page 236 13.4 Passing Arguments......Page 239 13.5 Special Argument Matching Modes......Page 242 Chapter 14. Advanced Function Topics......Page 249 14.1 Anonymous Functions: lambda......Page 250 14.2 Applying Functions to Arguments......Page 255 14.3 Mapping Functions Over Sequences......Page 257 14.4 Functional Programming Tools......Page 258 14.5 List Comprehensions......Page 259 14.6 Generators and Iterators......Page 263 14.7 Function Design Concepts......Page 266 14.8 Function Gotchas......Page 268 14.9 Part IV Exercises......Page 271 Part V: Modules......Page 273 Chapter 15. Modules: The Big Picture......Page 274 15.1 Why Use Modules?......Page 275 15.2 Python Program Architecture......Page 276 15.3 How Imports Work......Page 279 Chapter 16. Module Coding Basics......Page 284 16.1 Module Creation......Page 285 16.2 Module Usage......Page 286 16.3 Module Namespaces......Page 289 16.4 Reloading Modules......Page 293 Chapter 17. Module Packages......Page 296 17.1 Package Import Basics......Page 297 17.2 Package Import Example......Page 301 17.3 Why Use Package Imports?......Page 303 17.4 A Tale of Three Systems......Page 304 Chapter 18. Advanced Module Topics......Page 306 18.1 Data Hiding in Modules......Page 307 18.2 Enabling Future Language Features......Page 308 18.3 Mixed Usage Modes: __name__ and __main__......Page 309 18.4 Changing the Module Search Path......Page 310 18.5 The import as Extension......Page 311 18.6 Module Design Concepts......Page 312 18.7 Module Gotchas......Page 316 18.8 Part V Exercises......Page 321 Part VI: Classes and OOP......Page 323 Chapter 19. OOP: The Big Picture......Page 324 19.1 Why Use Classes?......Page 325 19.2 OOP from 30,000 Feet......Page 327 Chapter 20. Class Coding Basics......Page 333 20.1 Classes Generate Multiple Instance Objects......Page 334 20.2 Classes Are Customized by Inheritance......Page 337 20.3 Classes Can Intercept Python Operators......Page 340 Chapter 21. Class Coding Details......Page 342 21.1 The Class Statement......Page 343 21.2 Methods......Page 346 21.3 Inheritance......Page 348 21.4 Operator Overloading......Page 353 21.5 Namespaces: The Whole Story......Page 361 Chapter 22. Designing with Classes......Page 366 22.1 Python and OOP......Page 367 22.2 Classes as Records......Page 369 22.3 OOP and Inheritance: 'is-a' Relationships......Page 371 22.4 OOP and Composition: 'has-a' Relationships......Page 373 22.5 OOP and Delegation......Page 377 22.6 Multiple Inheritance......Page 378 22.7 Classes Are Objects: Generic Object Factories......Page 381 22.8 Methods Are Objects: Bound or Unbound......Page 384 22.9 Documentation Strings Revisited......Page 386 22.10 Classes Versus Modules......Page 388 Chapter 23. Advanced Class Topics......Page 389 23.1 Extending Built-in Types......Page 390 23.2 Pseudo-Private Class Attributes......Page 393 23.3 'New Style' Classes in Python 2.2......Page 396 23.4 Class Gotchas......Page 402 23.5 Part VI Exercises......Page 410 Part VII: Exceptions and Tools......Page 414 Chapter 24. Exception Basics......Page 415 24.1 Why Use Exceptions?......Page 416 24.2 Exception Handling: The Short Story......Page 418 24.3 The try/except/else Statement......Page 422 24.4 The try/finally Statement......Page 427 24.5 The raise Statement......Page 429 24.6 The assert Statement......Page 431 Chapter 25. Exception Objects......Page 433 25.1 String-Based Exceptions......Page 434 25.2 Class-Based Exceptions......Page 435 25.3 General raise Statement Forms......Page 442 Chapter 26. Designing with Exceptions......Page 443 26.1 Nesting Exception Handlers......Page 444 26.2 Exception Idioms......Page 447 26.3 Exception Design Tips......Page 451 26.4 Exception Gotchas......Page 454 26.5 Core Language Summary......Page 456 26.6 Part VII Exercises......Page 460 Part VIII: The Outer Layers......Page 461 Chapter 27. Common Tasks in Python......Page 462 27.1 Exploring on Your Own......Page 463 27.2 Conversions, Numbers, and Comparisons......Page 466 27.3 Manipulating Strings......Page 470 27.4 Data Structure Manipulations......Page 475 27.5 Manipulating Files and Directories......Page 480 27.6 Internet-Related Modules......Page 493 27.7 Executing Programs......Page 498 27.8 Debugging, Testing, Timing, Profiling......Page 501 27.9 Exercises......Page 504 Chapter 28. Frameworks......Page 505 28.1 An Automated Complaint System......Page 506 28.2 Interfacing with COM: Cheap Public Relations......Page 512 28.3 A Tkinter-Based GUI Editor for Managing Form Data......Page 516 28.4 Jython: The Felicitous Union of Python and Java......Page 521 28.5 Exercises......Page 527 Chapter 29. Python Resources......Page 528 29.1 Layers of Community......Page 529 29.2 The Process......Page 533 29.3 Services and Products......Page 534 29.4 The Legal Framework: The Python Software Foundation......Page 535 29.5 Software......Page 536 29.6 Popular Third-Party Software......Page 538 29.7 Web Application Frameworks......Page 546 29.8 Tools for Python Developers......Page 548 Part IX: Appendixes......Page 549 Appendix A. Installation and Configuration......Page 550 A.1 Installing the Python Interpreter......Page 551 Appendix B. Solutions to Exercises......Page 556 B.1 Part I, Getting Started......Page 557 B.2 Part II, Types and Operations......Page 559 B.3 Part III, Statements and Syntax......Page 564 B.4 Part IV, Functions......Page 566 B.5 Part V, Modules......Page 570 B.6 Part VI, Classes and OOP......Page 573 B.7 Part VII, Exceptions and Tools......Page 580 B.8 Part VIII, The Outer Layers......Page 582 Colophon......Page 588 Index......Page 589 Index SYMBOL......Page 590 Index A......Page 591 Index B......Page 593 Index C......Page 595 Index D......Page 600 Index E......Page 602 Index F......Page 604 Index G......Page 607 Index H......Page 608 Index I......Page 609 Index J......Page 612 Index K......Page 613 Index L......Page 614 Index M......Page 616 Index N......Page 618 Index O......Page 620 Index P......Page 622 Index Q......Page 625 Index R......Page 626 Index S......Page 628 Index T......Page 632 Index U......Page 635 Index V......Page 636 Index W......Page 637 Index X......Page 638 Index Z......Page 639 This new edition of 'Learning Python' provides programmers with a comprehensive and updated introduction to the interactive, object-oriented scripting language. The book introduces basic elements of the latest release of Python 2.2 and covers new features and addresses new topics of interest
دانلود کتاب Learning Python, 2nd Edition