Learning Python: Powerful Object-Oriented Programming

Learning Python: Powerful Object-Oriented Programming

by Mark Lutz
Learning Python: Powerful Object-Oriented Programming

Learning Python: Powerful Object-Oriented Programming

by Mark Lutz

Paperback(Fifth Edition)

$66.99  $74.99 Save 11% Current price is $66.99, Original price is $74.99. You Save 11%.
  • SHIP THIS ITEM
    Not Eligible for Free Shipping
  • PICK UP IN STORE
    Check Availability at Nearby Stores

Related collections and offers


Overview

Get a comprehensive, in-depth introduction to the core Python language with this hands-on book. Based on author Mark Lutz’s popular training course, this updated fifth edition will help you quickly write efficient, high-quality code with Python. It’s an ideal way to begin, whether you’re new to programming or a professional developer versed in other languages.

Complete with quizzes, exercises, and helpful illustrations, this easy-to-follow, self-paced tutorial gets you started with both Python 2.7 and 3.3— the latest releases in the 3.X and 2.X lines—plus all other releases in common use today. You’ll also learn some advanced language features that recently have become more common in Python code.

  • Explore Python’s major built-in object types such as numbers, lists, and dictionaries
  • Create and process objects with Python statements, and learn Python’s general syntax model
  • Use functions to avoid code redundancy and package code for reuse
  • Organize statements, functions, and other tools into larger components with modules
  • Dive into classes: Python’s object-oriented programming tool for structuring code
  • Write large programs with Python’s exception-handling model and development tools
  • Learn advanced Python tools, including decorators, descriptors, metaclasses, and Unicode processing

Product Details

ISBN-13: 9781449355739
Publisher: O'Reilly Media, Incorporated
Publication date: 07/03/2013
Edition description: Fifth Edition
Pages: 1540
Sales rank: 152,500
Product dimensions: 7.00(w) x 9.20(h) x 2.80(d)

About the Author

Mark Lutz is a leading Python trainer, the author of Python’s earliest and best-selling texts, and a pioneering figure in the Python world.



Mark is the author of the three O’Reilly books: Learning Python, Programming Python, and Python Pocket Reference, all currently in fourth or fifth editions. He has been using and promoting Python since 1992, started writing Python books in 1995, and began teaching Python classes in 1997. As of Spring 2013, Mark has instructed 260 Python training sessions, taught roughly 4,000 students in live classes, and written Python books that have sold 400,000 units and been translated to at least a dozen languages.



Together, his two decades of Python efforts have helped to establish it as one of the most widely used programming languages in the world today. In addition, Mark has been in the software field for 30 years. He holds BS and MS degrees in computer science from the University of Wisconsin where he explored implementations of the Prolog language, and over his career has worked as a professional software developer on compilers, programming tools, scripting applications, and assorted client/server systems.



Mark maintains a training website (http://learning-python.com) and an additional book support site on the Web (http://www.rmi.net/~lutz).

Table of Contents

Prefacexv
Part I.Getting Started
1.A Python Q&A Session3
Why Do People Use Python?3
Is Python a Scripting Language?5
Okay, But What's the Downside?6
Who Uses Python Today?7
What Can I Do with Python?8
What Are Python's Technical Strengths?11
How Does Python Stack Up to Language X?14
2.How Python Runs Programs16
Introducing the Python Interpreter16
Program Execution17
Execution Model Variations21
3.How You Run Programs25
Interactive Coding25
System Command Lines and Files28
Clicking Windows File Icons32
Module Imports and Reloads36
The IDLE User Interface40
Other IDEs44
Embedding Calls46
Frozen Binary Executables47
Text Editor Launch Options47
Other Launch Options47
Future Possibilities?47
Which Option Should I Use?48
Part I Exercises48
Part II.Types and Operations
4.Numbers53
Python Program Structure53
Why Use Built-in Types?53
Numbers55
Python Expression Operators57
Numbers in Action60
The Dynamic Typing Interlude68
5.Strings74
String Literals75
Strings in Action81
String Formatting87
String Methods90
General Type Categories95
6.Lists and Dictionaries97
Lists97
Lists in Action99
Dictionaries103
Dictionaries in Action105
7.Tuples, Files, and Everything Else112
Tuples112
Files115
Type Categories Revisited117
Object Generality118
References Versus Copies118
Comparisons, Equality, and Truth121
Python's Type Hierarchies123
Other Types in Python125
Built-in Type Gotchas125
Part II Exercises127
Part III.Statements and Syntax
8.Assignment, Expressions, and Print133
Assignment Statements134
Expression Statements140
Print Statements142
9.if Tests146
if Statements146
Python Syntax Rules149
Truth Tests152
10.while and for Loops155
while Loops155
break, continue, pass, and the Loop else156
for Loops160
Loop Variations164
11.Documenting Python Code171
The Python Documentation Interlude171
Common Coding Gotchas182
Part III Exercises184
Part IV.Functions
12.Function Basics189
Why Use Functions?189
Coding Functions190
A First Example: Definitions and Calls193
A Second Example: Intersecting Sequences194
13.Scopes and Arguments197
Scope Rules197
The global Statement202
Scopes and Nested Functions203
Passing Arguments207
Special Argument Matching Modes210
14.Advanced Function Topics219
Anonymous Functions: lambda219
Applying Functions to Arguments224
Mapping Functions Over Sequences227
Functional Programming Tools228
List Comprehensions229
Generators and Iterators233
Function Design Concepts236
Function Gotchas239
Part IV Exercises242
Part V.Modules
15.Modules: The Big Picture247
Why Use Modules?247
Python Program Architecture248
How Imports Work251
16.Module Coding Basics257
Module Creation257
Module Usage258
Module Namespaces261
Reloading Modules266
17.Module Packages270
Package Import Basics270
Package Import Example273
Why Use Package Imports?275
A Tale of Three Systems275
18.Advanced Module Topics279
Data Hiding in Modules279
Enabling Future Language Features280
Mixed Usage Modes: __name__ and __main__280
Changing the Module Search Path281
The import as Extension282
Module Design Concepts282
Module Gotchas285
Part V Exercises292
Part VI.Classes and OOP
19.OOP: The Big Picture297
Why Use Classes?297
OOP from 30,000 Feet299
20.Class Coding Basics307
Classes Generate Multiple Instance Objects307
Classes Are Customized by Inheritance310
Classes Can Intercept Python Operators314
21.Class Coding Details317
The Class Statement317
Methods320
Inheritance322
Operator Overloading327
Namespaces: The Whole Story337
22.Designing with Classes343
Python and OOP343
Classes as Records344
OOP and Inheritance: "is-a" Relationships346
OOP and Composition: "has-a" Relationships348
OOP and Delegation352
Multiple Inheritance353
Classes Are Objects: Generic Object Factories356
Methods Are Objects: Bound or Unbound358
Documentation Strings Revisited360
Classes Versus Modules362
23.Advanced Class Topics363
Extending Built-in Types363
Pseudo-Private Class Attributes366
"New Style" Classes in Python 2.2369
Class Gotchas376
Part VI Exercises384
Part VII.Exceptions and Tools
24.Exception Basics393
Why Use Exceptions?393
Exception Handling: The Short Story395
The try/except/else Statement399
The try/finally Statement404
The raise Statement405
The assert Statement408
25.Exception Objects410
String-Based Exceptions410
Class-Based Exceptions411
General raise Statement Forms418
26.Designing with Exceptions420
Nesting Exception Handlers420
Exception Idioms423
Exception Design Tips426
Exception Gotchas430
Core Language Summary432
Part VII Exercises436
Part VIII.The Outer Layers
27.Common Tasks in Python439
Conversions, Numbers, and Comparisons443
Manipulating Strings447
Data Structure Manipulations452
Manipulating Files and Directories458
Internet-Related Modules473
Executing Programs477
Debugging, Testing, Timing, Profiling480
Exercises483
28.Frameworks485
An Automated Complaint System486
Interfacing with COM: Cheap Public Relations492
A Tkinter-Based GUI Editor for Managing Form Data496
Jython: The Felicitous Union of Python and Java504
Exercises511
29.Python Resources513
Layers of Community513
The Process517
Services and Products518
The Legal Framework: The Python Software Foundation518
Software518
Popular Third-Party Software520
Web Application Frameworks529
Tools for Python Developers531
Part IX.Appendixes
A.Installation and Configuration535
B.Solutions to Exercises541
Index577
From the B&N Reads Blog

Customer Reviews