Publisher: O'Reilly Media Released: September 2009 Pages: 1216
Google and YouTube use Python because it's highly adaptable, easy to maintain, and allows for rapid development. If you want to write high-quality, efficient code that's easily integrated with other languages and tools, this hands-on book will help you be productive with Python quickly -- whether you're new to programming or just new to Python. It's an easy-to-follow self-paced tutorial, based on author and Python expert Mark Lutz's popular training course. Each chapter contains a stand-alone lesson on a key component of the language, and includes a unique Test Your Knowledge section with practical exercises and quizzes, so you can practice new skills and test your understanding as you go. You'll find lots of annotated examples and illustrations to help you get started with Python 3.0. - Learn about Python's major built-in object types, such as numbers, lists, and dictionaries
- Create and process objects using Python statements, and learn Python's general syntax model
- Structure and reuse code using functions, Python's basic procedural tool
- Learn about Python modules: packages of statements, functions, and other tools, organized into larger components
- Discover Python's object-oriented programming tool for structuring code
- Learn about the exception-handling model, and development tools for writing larger programs
- Explore advanced Python tools including decorators, descriptors, metaclasses, and Unicode processing
|
-
Getting Started -
Chapter 1 A Python Q&A Session - Why Do People Use Python?
- Is Python a “Scripting Language”?
- OK, but What’s the Downside?
- Who Uses Python Today?
- What Can I Do with Python?
- How Is Python Supported?
- What Are Python’s Technical Strengths?
- How Does Python Stack Up to Language X?
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 2 How Python Runs Programs - Introducing the Python Interpreter
- Program Execution
- Execution Model Variations
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 3 How You Run Programs - The Interactive Prompt
- System Command Lines and Files
- Clicking File Icons
- Module Imports and Reloads
- Using exec to Run Module Files
- The IDLE User Interface
- Other IDEs
- Other Launch Options
- Which Option Should I Use?
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
- Test Your Knowledge: Part I Exercises
-
Types and Operations -
Chapter 4 Introducing Python Object Types - Why Use Built-in Types?
- Numbers
- Strings
- Lists
- Dictionaries
- Tuples
- Files
- Other Core Types
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 5 Numeric Types - Numeric Type Basics
- Numbers in Action
- Other Numeric Types
- Numeric Extensions
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 6 The Dynamic Typing Interlude - The Case of the Missing Declaration Statements
- Shared References
- Dynamic Typing Is Everywhere
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 7 Strings - String Literals
- Strings in Action
- String Methods
- String Formatting Expressions
- String Formatting Method Calls
- General Type Categories
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 8 Lists and Dictionaries - Lists
- Lists in Action
- Dictionaries
- Dictionaries in Action
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 9 Tuples, Files, and Everything Else - Tuples
- Files
- Type Categories Revisited
- Object Flexibility
- References Versus Copies
- Comparisons, Equality, and Truth
- Python’s Type Hierarchies
- Other Types in Python
- Built-in Type Gotchas
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
- Test Your Knowledge: Part II Exercises
-
Statements and Syntax -
Chapter 10 Introducing Python Statements - Python Program Structure Revisited
- A Tale of Two ifs
- A Quick Example: Interactive Loops
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 11 Assignments, Expressions, and Prints - Assignment Statements
- Expression Statements
- Print Operations
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 12 if Tests and Syntax Rules - if Statements
- Python Syntax Rules
- Truth Tests
- The if/else Ternary Expression
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 13 while and for Loops - while Loops
- break, continue, pass, and the Loop else
- for Loops
- Loop Coding Techniques
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 14 Iterations and Comprehensions, Part 1 - Iterators: A First Look
- List Comprehensions: A First Look
- Other Iteration Contexts
- New Iterables in Python 3.0
- Other Iterator Topics
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 15 The Documentation Interlude - Python Documentation Sources
- Common Coding Gotchas
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
- Test Your Knowledge: Part III Exercises
-
Functions -
Chapter 16 Function Basics - Why Use Functions?
- Coding Functions
- A First Example: Definitions and Calls
- A Second Example: Intersecting Sequences
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 17 Scopes - Python Scope Basics
- The global Statement
- Scopes and Nested Functions
- The nonlocal Statement
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 18 Arguments - Argument-Passing Basics
- Special Argument-Matching Modes
- The min Wakeup Call!
- Generalized Set Functions
- Emulating the Python 3.0 print Function
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 19 Advanced Function Topics - Function Design Concepts
- Recursive Functions
- Function Objects: Attributes and Annotations
- Anonymous Functions: lambda
- Mapping Functions over Sequences: map
- Functional Programming Tools: filter and reduce
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 20 Iterations and Comprehensions, Part 2 - List Comprehensions Revisited: Functional Tools
- Iterators Revisited: Generators
- 3.0 Comprehension Syntax Summary
- Timing Iteration Alternatives
- Function Gotchas
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
- Test Your Knowledge: Part IV Exercises
-
Modules -
Chapter 21 Modules: The Big Picture - Why Use Modules?
- Python Program Architecture
- How Imports Work
- The Module Search Path
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 22 Module Coding Basics - Module Creation
- Module Usage
- Module Namespaces
- Reloading Modules
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 23 Module Packages - Package Import Basics
- Package Import Example
- Why Use Package Imports?
- Package Relative Imports
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 24 Advanced Module Topics - Data Hiding in Modules
- Enabling Future Language Features
- Mixed Usage Modes: __name__ and __main__
- Changing the Module Search Path
- The as Extension for import and from
- Modules Are Objects: Metaprograms
- Importing Modules by Name String
- Transitive Module Reloads
- Module Design Concepts
- Module Gotchas
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
- Test Your Knowledge: Part V Exercises
-
Classes and OOP -
Chapter 25 OOP: The Big Picture - Why Use Classes?
- OOP from 30,000 Feet
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 26 Class Coding Basics - Classes Generate Multiple Instance Objects
- Classes Are Customized by Inheritance
- Classes Can Intercept Python Operators
- The World’s Simplest Python Class
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 27 A More Realistic Example - Step 1: Making Instances
- Step 2: Adding Behavior Methods
- Step 3: Operator Overloading
- Step 4: Customizing Behavior by Subclassing
- Step 5: Customizing Constructors, Too
- Step 6: Using Introspection Tools
- Step 7 (Final): Storing Objects in a Database
- Future Directions
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 28 Class Coding Details - The class Statement
- Methods
- Inheritance
- Namespaces: The Whole Story
- Documentation Strings Revisited
- Classes Versus Modules
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 29 Operator Overloading - The Basics
- Indexing and Slicing: __getitem__ and __setitem__
- Index Iteration: __getitem__
- Iterator Objects: __iter__ and __next__
- Membership: __contains__, __iter__, and __getitem__
- Attribute Reference: __getattr__ and __setattr__
- String Representation: __repr__ and __str__
- Right-Side and In-Place Addition: __radd__ and __iadd__
- Call Expressions: __call__
- Comparisons: __lt__, __gt__, and Others
- Boolean Tests: __bool__ and __len__
- Object Destruction: __del__
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 30 Designing with Classes - Python and OOP
- OOP and Inheritance: “Is-a” Relationships
- OOP and Composition: “Has-a” Relationships
- OOP and Delegation: “Wrapper” Objects
- Pseudoprivate Class Attributes
- Methods Are Objects: Bound or Unbound
- Multiple Inheritance: “Mix-in” Classes
- Classes Are Objects: Generic Object Factories
- Other Design-Related Topics
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 31 Advanced Class Topics - Extending Built-in Types
- The “New-Style” Class Model
- New-Style Class Changes
- New-Style Class Extensions
- Static and Class Methods
- Decorators and Metaclasses: Part 1
- Class Gotchas
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
- Test Your Knowledge: Part VI Exercises
-
Exceptions and Tools -
Chapter 32 Exception Basics - Why Use Exceptions?
- Exceptions: The Short Story
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 33 Exception Coding Details - The try/except/else Statement
- The try/finally Statement
- Unified try/except/finally
- The raise Statement
- The assert Statement
- with/as Context Managers
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 34 Exception Objects - Exceptions: Back to the Future
- Why Exception Hierarchies?
- Built-in Exception Classes
- Custom Print Displays
- Custom Data and Behavior
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 35 Designing with Exceptions - Nesting Exception Handlers
- Exception Idioms
- Exception Design Tips and Gotchas
- Core Language Summary
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
- Test Your Knowledge: Part VII Exercises
-
Advanced Topics -
Chapter 36 Unicode and Byte Strings - String Changes in 3.0
- String Basics
- Python 3.0 Strings in Action
- Coding Unicode Strings
- Using 3.0 Bytes Objects
- Using 3.0 (and 2.6) bytearray Objects
- Using Text and Binary Files
- Using Unicode Files
- Other String Tool Changes in 3.0
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 37 Managed Attributes - Why Manage Attributes?
- Properties
- Descriptors
- __getattr__ and __getattribute__
- Example: Attribute Validations
- Chapter Summary
- Test Your Knowledge: Quiz
-
Chapter 38 Decorators - What’s a Decorator?
- The Basics
- Coding Function Decorators
- Coding Class Decorators
- Managing Functions and Classes Directly
- Example: “Private” and “Public” Attributes
- Example: Validating Function Arguments
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Chapter 39 Metaclasses - To Metaclass or Not to Metaclass
- The Metaclass Model
- Declaring Metaclasses
- Coding Metaclasses
- Example: Adding Methods to Classes
- Example: Applying Decorators to Methods
- Chapter Summary
- Test Your Knowledge: Quiz
- Test Your Knowledge: Answers
-
Appendixes -
Appendix Installation and Configuration - Installing the Python Interpreter
- Configuring Python
- For More Help
-
Appendix Solutions to End-of-Part Exercises - Part I, Getting Started
- Part II, Types and Operations
- Part III, Statements and Syntax
- Part IV, Functions
- Part V, Modules
- Part VI, Classes and OOP
- Part VII, Exceptions and Tools
-
Colophon |
- Title:
- Learning Python, 4th Edition
- By:
- Mark Lutz
- Publisher:
- O'Reilly Media
- Formats:
-
- Print
- Ebook
- Safari Books Online
- Print:
- October 2009
- Ebook:
- September 2009
- Pages:
- 1216
- Print ISBN:
- 978-0-596-15806-4
- | ISBN 10:
- 0-596-15806-8
- Ebook ISBN:
- 978-0-596-80598-2
- | ISBN 10:
- 0-596-80598-5
|
-
Mark Lutz Mark Lutz is the world leader in Python training, the author of Python's earliest and best-selling texts, and a pioneering figure in the Python community since 1992. He is also the author of O'Reilly's Programming Python, Python Pocket Reference, and Learning Python (all in 4th Editions). Mark can be reached on the web at www.rmi.net. View Mark Lutz's full profile page. |
Colophon The animal on the cover of Learning Python, Fourth Edition, is a wood rat (Neotoma Muridae). The wood rat lives in a wide range of conditions (mostly rocky, scrub, anddesert areas) over much of North and Central America, generally at some distance fromhumans. Wood rats are good climbers, nesting in trees or bushes up to six meters offthe ground; some species burrow underground or in rock crevices or inhabit otherspecies' abandoned holes. These grayish-beige, medium-size rodents are the original pack rats: they carry anythingand everything into their homes, whether or not it's needed, and are especially attractedto shiny objects such as tin cans, glass, and silverware. The cover image is a 19th-century engraving from Cuvier's Animals. The cover font is Adobe ITC Garamond. The text font is Linotype Birka; the heading font is Adobe Myriad Condensed; and the code font is LucasFont's TheSansMonoCondensed. |
|
Description
|
Table of Contents
|
Product Details
|
About the Author
|
Colophon
|
 |
|
 |
|
|
|
Recommended for You
|
Recently Viewed
|
 |
|
By Paul Robichaux
April 1998
By Paul Robichaux
August 2000
By Gene Steinberg, Pieter Paulson
May 2003
|
Customer Reviews

12/6/2011 (1 of 2 customers found this review helpful) 1.0You never need this book By Rajesh from Bangalore About Me Designer, Developer 6/28/2011 (8 of 8 customers found this review helpful) 4.0In a word 'Comprehensive' By Joy of Duck from UK About Me Developer, Educator - Accurate
- Comprehensive
- Helpful examples
- Well-written
- Expert
- Intermediate
- Student
3/11/2011 (5 of 5 customers found this review helpful) 4.0Makes simple concepts hard to understand By Nick the Python from Iran 3/9/2011 (1 of 1 customers found this review helpful) 5.0Excellent book for a trainer By srinirad from Bangalore,India - Accurate
- Concise
- Helpful examples
- Well-written
2/10/2011 (3 of 10 customers found this review helpful) By HFO from Murray Hill, NJ 11/20/2010 (5 of 5 customers found this review helpful) By Little Zanooda from San Jose, CA About Me Developer, Sys Admin - Accurate
- Concise
- Easy to understand
6/6/2010 (3 of 10 customers found this review helpful) By Julius the self taught python programmer from San Jose, ca About Me Developer, Independent Learner - Accurate
- Helpful examples
- Highly in-depth
- Well-written
- Worth the time
- Difficult to understand
- Not enough examples
- Time consuming
- Verbose
12/25/2009 (19 of 21 customers found this review helpful) 5.0Best Programming Book I've Run Into - Accurate
- Concise
- Helpful examples
12/25/2009 (18 of 19 customers found this review helpful) 5.0Great Book - a comprehensive look at Py By Austin550i from Austin, Tx - Accurate
- Easy to understand
- Helpful examples
- Well-written
- Intermediate
- Novice
- Student
10/5/2009 (21 of 68 customers found this review helpful) By Jim the Thin-Wristed from Los Alamos, NM About Me Designer, Developer, Scientist - Bulky
- Heavy
- Oversized
- Unwieldy
|
|
|
Merchant response: I'm sorry to hear that this book was a disappointment. We have a 100% satisfaction guarantee, and you can find refund details at http://oreilly.com/oreilly/cs/guarantee.html
Regards,
Rachel James
O'Reilly Media