Book description
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.
Publisher resources
Table of contents
- Dedication
- A Note Regarding Supplemental Files
- Preface
-
I. Getting Started
- 1. A Python Q&A Session
- 2. How Python Runs Programs
-
3. How You Run Programs
- 3.1. Interactive Coding
- 3.2. System Command Lines and Files
- 3.3. Clicking Windows File Icons
- 3.4. Module Imports and Reloads
- 3.5. The IDLE User Interface
- 3.6. Other IDEs
- 3.7. Embedding Calls
- 3.8. Frozen Binary Executables
- 3.9. Text Editor Launch Options
- 3.10. Other Launch Options
- 3.11. Future Possibilities?
- 3.12. Which Option Should I Use?
- 3.13. Part I Exercises
-
II. Types and Operations
- 4. Numbers
- 5. Strings
- 6. Lists and Dictionaries
- 7. Tuples, Files, and Everything Else
-
III. Statements and Syntax
- 8. Assignment, Expressions, and Print
- 9. if Tests
- 10. while and for Loops
-
11. Documenting Python Code
- 11.1. The Python Documentation Interlude
- 11.2. Common Coding Gotchas
- 11.3. Part III Exercises
-
IV. Functions
- 12. Function Basics
-
13. Scopes and Arguments
- 13.1. Scope Rules
- 13.2. The global Statement
- 13.3. Scopes and Nested Functions
- 13.4. Passing Arguments
- 13.5. Special Argument Matching Modes
- 14. Advanced Function Topics
-
V. Modules
- 15. Modules: The Big Picture
- 16. Module Coding Basics
- 17. Module Packages
-
18. Advanced Module Topics
- 18.1. Data Hiding in Modules
- 18.2. Enabling Future Language Features
- 18.3. Mixed Usage Modes: __name__ and __main__
- 18.4. Changing the Module Search Path
- 18.5. The import as Extension
- 18.6. Module Design Concepts
-
18.7. Module Gotchas
- 18.7.1. Importing Modules by Name String
- 18.7.2. from Copies Names but Doesn’t Link
- 18.7.3. Statement Order Matters in Top-Level Code
- 18.7.4. Recursive “from” Imports May Not Work
- 18.7.5. reload May Not Impact from Imports
- 18.7.6. reload and from and Interactive Testing
- 18.7.7. reload Isn’t Applied Transitively
- 18.8. Part V Exercises
-
VI. Classes and OOP
- 19. OOP: The Big Picture
- 20. Class Coding Basics
-
21. Class Coding Details
- 21.1. The Class Statement
- 21.2. Methods
- 21.3. Inheritance
-
21.4. Operator Overloading
- 21.4.1. Common Operator Overloading Methods
- 21.4.2. __getitem__ Intercepts Index References
- 21.4.3. __getitem__ and __iter__ Implement Iteration
- 21.4.4. __getattr__ and __setattr__ Catch Attribute References
- 21.4.5. __repr__ and __str__Return String Representations
- 21.4.6. __radd__ Handles Right-Side Addition
- 21.4.7. __call__ Intercepts Calls
- 21.4.8. __del__ Is a Destructor
- 21.5. Namespaces: The Whole Story
-
22. Designing with Classes
- 22.1. Python and OOP
- 22.2. Classes as Records
- 22.3. OOP and Inheritance: “is-a” Relationships
- 22.4. OOP and Composition: “has-a” Relationships
- 22.5. OOP and Delegation
- 22.6. Multiple Inheritance
- 22.7. Classes Are Objects: Generic Object Factories
- 22.8. Methods Are Objects: Bound or Unbound
- 22.9. Documentation Strings Revisited
- 22.10. Classes Versus Modules
-
23. Advanced Class Topics
- 23.1. Extending Built-in Types
- 23.2. Pseudo-Private Class Attributes
- 23.3. “New Style” Classes in Python 2.2
- 23.4. Class Gotchas
- 23.5. Part VI Exercises
-
VII. Exceptions and Tools
- 24. Exception Basics
- 25. Exception Objects
- 26. Designing with Exceptions
-
VIII. The Outer Layers
-
27. Common Tasks in Python
- 27.1. Exploring on Your Own
- 27.2. Conversions, Numbers, and Comparisons
- 27.3. Manipulating Strings
- 27.4. Data Structure Manipulations
-
27.5. Manipulating Files and Directories
- 27.5.1. The os and os.path Modules
- 27.5.2. Copying Files and Directories: The shutil Module
- 27.5.3. Filenames and Directories
- 27.5.4. Matching Sets of Files
- 27.5.5. Using Temporary Files
- 27.5.6. Modifying Input and Outputs
-
27.5.7. Using Standard I/O to Process Files
- 27.5.7.1. Finding all lines that start with a #
- 27.5.7.2. Extracting the fourth column of a file (where columns are defined by whitespace)
- 27.5.7.3. Extracting the fourth column of a file, where columns are separated by colons, and making it lowercase
- 27.5.7.4. Printing the first 10 lines, the last 10 lines, and every other line
- 27.5.7.5. Counting the number of times the word “Python” occurs in a file
- 27.5.7.6. Changing a list of columns into a list of rows
- 27.5.7.7. Choosing chunk sizes
- 27.5.8. Doing Something to a Set of Files Specified on the Command Line
- 27.5.9. Processing Each Line of One or More Files
- 27.5.10. Dealing with Binary Data: The struct Module
- 27.6. Internet-Related Modules
- 27.7. Executing Programs
- 27.8. Debugging, Testing, Timing, Profiling
- 27.9. Exercises
- 28. Frameworks
-
29. Python Resources
- 29.1. Layers of Community
- 29.2. The Process
- 29.3. Services and Products
- 29.4. The Legal Framework: The Python Software Foundation
- 29.5. Software
- 29.6. Popular Third-Party Software
- 29.7. Web Application Frameworks
- 29.8. Tools for Python Developers
-
27. Common Tasks in Python
-
IX. Appendixes
- A. Installation and Configuration
- B. Solutions to Exercises
- About the Authors
- Colophon
- Copyright
Product information
- Title: Learning Python, 2nd Edition
- Author(s):
- Release date: December 2003
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9780596002817
You might also like
book
Learning Python, 3rd Edition
Portable, powerful, and a breeze to use, Python is ideal for bothstandalone programs and scripting applications. …
book
Learning Python, 5th Edition
Get a comprehensive, in-depth introduction to the core Python language with this hands-on book. Based on …
book
Effective Python: 90 Specific Ways to Write Better Python, 2nd Edition
Updated and Expanded for Python 3 It’s easy to start developing programs with Python, which is …
book
Python Crash Course, 2nd Edition
This is the second edition of the best selling Python book in the world. Python Crash …