O'Reilly - Learning Python, 2nd Edition - From The O'Reilly Anthology.pdf

(5944 KB) Pobierz
[ Team LiB ]
Table of Contents
Index
Reviews
Reader Reviews
Errata
Academic
Learning Python, 2nd Edition
By
David Ascher
,
Mark Lutz
Publisher: O'Reilly
Pub Date: December 2003
ISBN: 0-596-00281-5
Pages: 620
Learning Python,
Second Edition offers programmers a comprehensive learning tool for Python and object-oriented programming.
Thoroughly updated, 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.
[ Team LiB ]
[ Team LiB ]
Table of Contents
Index
Reviews
Reader Reviews
Errata
Academic
Learning Python, 2nd Edition
By
David Ascher
,
Mark Lutz
Publisher: O'Reilly
Pub Date: December 2003
ISBN: 0-596-00281-5
Pages: 620
Copyright
Dedication
Preface
About This Second Edition
Prerequisites
This Book's Scope
This Book's Style and Structure
Book Updates
Font Conventions
About the Programs in This Book
Using Code Examples
How to Contact Us
Acknowledgments
Part I: Getting Started
Chapter 1. A Python Q&A Session
Section 1.1. Why Do People Use Python?
Section 1.2. Is Python a Scripting Language?
Section 1.3. Okay, But What's the Downside?
Section 1.4. Who Uses Python Today?
Section 1.5. What Can I Do with Python?
Section 1.6. What Are Python's Technical Strengths?
Section 1.7. How Does Python Stack Up to Language X?
Chapter 2. How Python Runs Programs
Section 2.1. Introducing the Python Interpreter
Section 2.2. Program Execution
Section 2.3. Execution Model Variations
Chapter 3. How You Run Programs
Section 3.1. Interactive Coding
Section 3.2. System Command Lines and Files
Section 3.3. Clicking Windows File Icons
Section 3.4. Module Imports and Reloads
Section 3.5. The IDLE User Interface
Section 3.6. Other IDEs
Section 3.7. Embedding Calls
Section 3.8. Frozen Binary Executables
Section 3.9. Text Editor Launch Options
Section 3.10. Other Launch Options
Section 3.11. Future Possibilities?
Section 3.12. Which Option Should I Use?
Section 3.13. Part I Exercises
Part II: Types and Operations
Chapter 4. Numbers
Section 4.1. Python Program Structure
Section 4.2. Why Use Built-in Types?
Section 4.3. Numbers
Section 4.4. Python Expression Operators
Section 4.5. Numbers in Action
Section 4.6. The Dynamic Typing Interlude
Chapter 5. Strings
Section 5.1. String Literals
Section 5.2. Strings in Action
Section 5.3. String Formatting
Section 5.4. String Methods
Section 5.5. General Type Categories
Chapter 6. Lists and Dictionaries
Section 6.1. Lists
Section 6.2. Lists in Action
Section 6.3. Dictionaries
Section 6.4. Dictionaries in Action
Chapter 7. Tuples, Files, and Everything Else
Section 7.1. Tuples
Section 7.2. Files
Section 7.3. Type Categories Revisited
Section 7.4. Object Generality
Section 7.5. References Versus Copies
Section 7.6. Comparisons, Equality, and Truth
Section 7.7. Python's Type Hierarchies
Section 7.8. Other Types in Python
Section 7.9. Built-in Type Gotchas
Section 7.10. Part II Exercises
Part III: Statements and Syntax
Chapter 8. Assignment, Expressions, and Print
Section 8.1. Assignment Statements
Section 8.2. Expression Statements
Section 8.3. Print Statements
Chapter 9. if Tests
Section 9.1. if Statements
Section 9.2. Python Syntax Rules
Section 9.3. Truth Tests
Chapter 10. while and for Loops
Section 10.1. while Loops
Section 10.2. break, continue, pass, and the Loop else
Section 10.3. for Loops
Section 10.4. Loop Variations
Chapter 11. Documenting Python Code
Section 11.1. The Python Documentation Interlude
Section 11.2. Common Coding Gotchas
Section 11.3. Part III Exercises
Part IV: Functions
Chapter 12. Function Basics
Section 12.1. Why Use Functions?
Section 12.2. Coding Functions
Section 12.3. A First Example: Definitions and Calls
Section 12.4. A Second Example: Intersecting Sequences
Chapter 13. Scopes and Arguments
Section 13.1. Scope Rules
Section 13.2. The global Statement
Section 13.3. Scopes and Nested Functions
Section 13.4. Passing Arguments
Section 13.5. Special Argument Matching Modes
Chapter 14. Advanced Function Topics
Section 14.1. Anonymous Functions: lambda
Section 14.2. Applying Functions to Arguments
Section 14.3. Mapping Functions Over Sequences
Section 14.4. Functional Programming Tools
Section 14.5. List Comprehensions
Section 14.6. Generators and Iterators
Section 14.7. Function Design Concepts
Section 14.8. Function Gotchas
Section 14.9. Part IV Exercises
Part V: Modules
Chapter 15. Modules: The Big Picture
Section 15.1. Why Use Modules?
Section 15.2. Python Program Architecture
Section 15.3. How Imports Work
Chapter 16. Module Coding Basics
Section 16.1. Module Creation
Section 16.2. Module Usage
Section 16.3. Module Namespaces
Section 16.4. Reloading Modules
Chapter 17. Module Packages
Section 17.1. Package Import Basics
Section 17.2. Package Import Example
Section 17.3. Why Use Package Imports?
Section 17.4. A Tale of Three Systems
Chapter 18. Advanced Module Topics
Section 18.1. Data Hiding in Modules
Section 18.2. Enabling Future Language Features
Section 18.3. Mixed Usage Modes: __name__ and __main__
Section 18.4. Changing the Module Search Path
Section 18.5. The import as Extension
Section 18.6. Module Design Concepts
Section 18.7. Module Gotchas
Section 18.8. Part V Exercises
Part VI: Classes and OOP
Chapter 19. OOP: The Big Picture
Section 19.1. Why Use Classes?
Section 19.2. OOP from 30,000 Feet
Chapter 20. Class Coding Basics
Section 20.1. Classes Generate Multiple Instance Objects
Section 20.2. Classes Are Customized by Inheritance
Section 20.3. Classes Can Intercept Python Operators
Chapter 21. Class Coding Details
Section 21.1. The Class Statement
Section 21.2. Methods
Section 21.3. Inheritance
Section 21.4. Operator Overloading
Section 21.5. Namespaces: The Whole Story
Chapter 22. Designing with Classes
Section 22.1. Python and OOP
Section 22.2. Classes as Records
Section 22.3. OOP and Inheritance: "is-a" Relationships
Section 22.4. OOP and Composition: "has-a" Relationships
Section 22.5. OOP and Delegation
Section 22.6. Multiple Inheritance
Section 22.7. Classes Are Objects: Generic Object Factories
Section 22.8. Methods Are Objects: Bound or Unbound
Section 22.9. Documentation Strings Revisited
Section 22.10. Classes Versus Modules
Chapter 23. Advanced Class Topics
Section 23.1. Extending Built-in Types
Section 23.2. Pseudo-Private Class Attributes
Section 23.3. "New Style" Classes in Python 2.2
Section 23.4. Class Gotchas
Section 23.5. Part VI Exercises
Part VII: Exceptions and Tools
Chapter 24. Exception Basics
Section 24.1. Why Use Exceptions?
Section 24.2. Exception Handling: The Short Story
Section 24.3. The try/except/else Statement
Section 24.4. The try/finally Statement
Zgłoś jeśli naruszono regulamin